log4j日志实现重复警告slf4j-jdk14和log4j-over-slf4j

因为各种三方库依赖的log4j实现不同,所以可能会出现找到多个log4j实现的警告,但是不影响程序(logback是会影响的),如下:

SLF4J: Class path contains multiple SLF4J bindings.  
SLF4J: Found binding in [jar:file:/D:/software/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]  
SLF4J: Found binding in [jar:file:/D:/software/log4j-slf4j-impl-2.4.1.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]  

这通常是因为同时包含了slf4j-jdk14和log4j-over-slf4j,所以去掉slf4j-jdk14,保留log4j-over-slf4j即可。警告即消失。

猜你喜欢

转载自www.cnblogs.com/zhjh256/p/10721290.html