SLF4J: Class path contains multiple SLF4J bindings 问题解决

SpringBoot 启动后输出:

DEBUG StatusLogger org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good!
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/xxx/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/xxx/.m2/repository/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

 

系统能正常正常启动,这个提示是因为存在多个日志实现绑定,即:

(1) logback-classic-1.2.3.jar 

(2) slf4j-simple-1.7.25.jar

【SLF4j : Simple Logging Facade for Java (SLF4J),目前用的比较多的日志门面,类似commons-log库】

SpringBoot默认用的logback,那就把slf4j-simple给禁用掉。可以通过idea的查找依赖关系或mvn dependency:tree 来找到依赖

最后发现是j2cache依赖了slf4j-simple

        <dependency>
            <groupId>net.oschina.j2cache</groupId>
            <artifactId>j2cache-core</artifactId>
            <version>2.7.2-release</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

增加排除,问题解决。

 

 

posted on 2021-04-04 18:02  webjlwang  阅读(2027)  评论(0编辑  收藏  举报

导航