vieyahn2017 / iBlog

44 stars 0 forks source link

11.28 logback无法生成日志文件 #374

Closed vieyahn2017 closed 3 months ago

vieyahn2017 commented 3 years ago

logback无法生成日志文件

vieyahn2017 commented 3 years ago

这次遇到的是 log4j,slf4j, logback冲突问题

vieyahn2017 commented 3 years ago

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file://lib/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file://lib/logback-classic-1.2.3.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.***.Main). 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:WARN No appenders could be found for logger (com....). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

vieyahn2017 commented 3 years ago

跟这个差不多的问题:

https://blog.csdn.net/jyj1100/article/details/83217624

slf4j与logback冲突问题

jyj019 2018-10-20 22:27:23 6195 收藏 2 分类专栏: 程序基础 文章标签: java 异常 版权 slf4j与logback冲突问题 最近发现配置日志中slf4j和logback冲突,导致日志无法打出。

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/.m2/repository/org/slf4j/slf4j-log4j12/1.7.10/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 发现需要排除logback包,经过检查,发现logback包在opentsdb中。排除后解决问题。

vieyahn2017 commented 3 years ago

直接粗暴的解决方法:

删除后正常,删除这个:slf4j-log4j12-1.6.1.jar

find /***/softwarepath  -iname slf4j-log4j12-1.7.30.jar -exec rm -rf {} \;
vieyahn2017 commented 3 years ago

mvn dependency:tree

vieyahn2017 commented 3 years ago

Maven解决类包依赖冲突:mvn dependency:tree

https://blog.csdn.net/kanpiaoxue/article/details/84834332

kanpiaoxue 2017-01-06 18:45:50 381 收藏 分类专栏: maven 非技术 经验 文章标签: java 版权

在使用maven管理jar的依赖关系的时候,经常发生jar的不同版本冲突。如何解决呢?

使用命令: mvn dependency:tree 来查看依赖关系树形结构,从中排查冲突的jar。