java日志框架冲突介绍
所属分类 java
浏览量 1572
日志框架
桥接 转调 绑定
日志门面接口 slf4j jcl(commons-logging)
桥接 绑定
日志实现 log4j jul(java.util.logging) logback
A-to-B.jar B-to-A.jar 两个桥接器 死循环 stack overflow
https://www.slf4j.org/manual.html
Exception in thread "main" java.lang.StackOverflowError
at java.util.Hashtable.containsKey(Hashtable.java:306)
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:36)
at org.apache.log4j.LogManager.getLogger(LogManager.java:39)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:249)
at org.apache.log4j.Category.(Category.java:53)
at org.apache.log4j.Logger..(Logger.java:35)
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:39)
at org.apache.log4j.LogManager.getLogger(LogManager.java:39)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:249)
at org.apache.log4j.Category..(Category.java:53)
at org.apache.log4j.Logger..(Logger.java:35)
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:39)
at org.apache.log4j.LogManager.getLogger(LogManager.java:39)
subsequent lines omitted...
易导致 死循环的组合
log4j-over-slf4j 和 slf4j-log4j12
jcl-over-slf4j.jar 和 slf4j-jcl.jar
上一篇
下一篇
spring注解之@Value
金融圈饭局老司机火眼金睛识人
云原生应用12要素
slf4j集成log4j
java日志系统转换
log4j无缝迁移到logback