栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

springboot 关于 Class path contains multiple SLF4J bindings.警告的maven解决

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

springboot 关于 Class path contains multiple SLF4J bindings.警告的maven解决

启动时报错信息

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/cb/.m2/repository/ch/qos/logback/logback-classic/1.2.10/logback-classic-1.2.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/cb/.m2/repository/org/slf4j/slf4j-log4j12/1.7.33/slf4j-log4j12-1.7.33.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]

问题分析

logback-classic-1.2.10.jar和slf4j-log4j12-1.7.33.jar同时引用了

查看疯关系图

 解决办法

修改pom.xmlgmf 

        
            org.apache.dubbo
            dubbo-dependencies-zookeeper
            3.0.5
            pom
            
                
                    org.slf4j
                    slf4j-log4j12
                
            
        

再次启动没有上面的错误了

看日志有如下警告

log4j:WARN No appenders could be found for logger (org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationPostProcessor).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 

解决办法

增加log4j.properties文件

###set log levels###
log4j.rootLogger=info, stdout
###output to the console###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/728056.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号