spring boot 配置 druid的filters时报错 Reason: org.apache.log4j.Priority

报错信息:

Failed to bind properties under ‘spring.datasource.druid’ to javax.sql.DataSource:

Property: spring.datasource.druid.filters
Value: stat,wall,log4j
Origin: class path resource [application.yml]:21:16
Reason: org.apache.log4j.Priority
解决方案:
缺少log4j的包,依赖如下:
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
    </dependency>

上面使用spring boot提供的日志适配包,其实这个jar中的记录日志的功能最终调用的还是LogBack框架的,这样的话我们的系统就不会去使用多个日志框架!

点赞