java - spring boot 配置 logback 启动错误
巴扎黑
巴扎黑 2017-04-17 17:43:05
[Java讨论组]

我使用的是spring-boot 1.3 logback-1.1.5 版本
首先是boot配置

# Mysql
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/test2?createDatabaseIfNotExist=true
spring.datasource.username = root
spring.datasource.password = root

# jpa
spring.jpa.database = MYSQL
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

## log
logging.level.com.trs.trsirp = DEBUG
#logging.file = logs/logback.log

接下来是logback配置:



    
    
    
    
        
            
            
                
        
    

    
    
    
    
    
    

    
    
        
        
            
            
                com.mysql.jdbc.Driver
                jdbc:mysql://localhost:3306/test2
                root
                root
            
        
    

    
    
        
        
    

在接下来是报错:

Exception in thread "main" java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.joran.spi.Interpreter@28:66 - no applicable action for [dataSource], current ElementPath  is [[configuration][appender][connectionSource][dataSource]]

如果把配置里面的

dataSource 

去掉就可以运行,但是为什么加上就出现这样的错误 ?
第二个问题就是如果把

root 标签的level改成debug

启动就会卡在spring-boot 1.3 启动最开始有一个图案那就地方,不会往下执行 ,这是为什么 ?

巴扎黑
巴扎黑

全部回复(1)
阿神

connectionSource配置错了,你配置的那个类不支持datasource配置。要支持的话,可以换成

ch.qos.logback.core.db.DataSourceConnectionSource
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号