SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

问题说明:

Spring  Boot启动报错,导致代码中配置的org.slf4j.Logger 没有输出日志。

private final static Logger logger = LoggerFactory.getLogger(xx.class);

 

错误原因:

缺少日志相关jar包或者jar包版本错误。

 

解决方法:

下面是我项目中的pom大家可以试一下:

<dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.10.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.10.0</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.10.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>1.7.25</version>
        </dependency>

 

 

posted @ 2020-01-09 00:10  一锤子技术员  阅读(12)  评论(0编辑  收藏  举报  来源