首页  

日志框架冲突及解决方法     所属分类 architecture 浏览量 1529
错误1
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/dugang/m2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/dugang/m2/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.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Exception in thread "main" java.lang.StackOverflowError

slf4j-log4j12



错误2
SLF4J: Found binding in [jar:file:/home/admin/dyyx/myweb.jar!/BOOT-INF/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: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. 
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
Exception in thread "main" java.lang.ExceptionInInitializerError

log4j-over-slf4j.jar    log4j 转到 slf4j
slf4j-log4j12           slf4j 转到 log4j12 
这两者死循环





解决方法

一般使用 slf4j + logback 组合  ,排除 slf4j-log4j12


<exclusions>
      <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
      </exclusion>
</exclusions>




 jar包冲突处理 
 java日志框架冲突介绍 
 java日志系统转换 
 slf4j简介 
 java日志框架简介 

上一篇     下一篇
grafana 日PV 柱状图

prometheus 查询例子

springboot ApplicationContextInitializer 使用

linux熵池太小导致随机函数阻塞

Random和SecureRandom

熵池与SecureRandom