版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/leave417/article/details/89546589
系统启动报错:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.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]
解决办法:
pom增加
<!-- 日志包 防止日志冲突 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
正常启动虽然依旧会显示多个日志,但是已经可以正常启动;
记录其他无效或问题办法:
删除对应路径下的slf4j-log4j12-1.7.10.jar jar包,
问题点:
1.maven重新编译时,依旧会下载该jar包,无法从根源解决问题;
2.删除jar包后,控制台无日志;
另外的办法:
如果是多模块系统,可以考虑排除对应的多余jar包,但是时间成本太高,倒不如直接显示引用,避免冲突比较方便;