问题背景 在进行logback的日志输出测试时,显示如下错误 SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/D:/
SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/D:/LenovoSoftstore/softdate/idealp/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/D:/LenovoSoftstore/softdate/Idealp/.m2/repository/ch/qos/logback/logback-classic/1.2.6/logback-classic-1.2.6.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 [org.slf4j.impl.Log4jLoggerFactory]log4j:WARN No appenders could be found for logger (com.health.controller.UserController).log4j:WARN Please initialize the log4j system properly.log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
原因
根据上面的错误提示,存在多个SLF4J bindings绑定,即存在多个slf4j的实现类,按上图所示这两个实现分别是logback-classic-1.2.6和slf4j-log4j12-1.6.1
,我们需要的是logback而不是log4j,
3、解决方案
因此,我们去掉log4j的依赖就行;查找slf4j-log4j12-1.6.1并将其删除
来源地址:https://blog.csdn.net/hsuehgw/article/details/128057054
--结束END--
本文标题: Class path contains multiple SLF4J bindings.问题原因及解决方案
本文链接: https://lsjlt.com/news/378595.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-04-01
2024-04-03
2024-04-03
2024-01-21
2024-01-21
2024-01-21
2024-01-21
2023-12-23
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0