报错信息如下
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
at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:72)
at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:45)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
在pom中排除 slf4j-log4j12、org.slf4j等包没有用,仍然报错。
org.slf4j
log4j-over-slf4j
org.apache.logging.log4j
log4j-api
org.slf4j
slf4j-log4j12
修改为在pom中排除
ch.qos.logback
logback-core
ch.qos.logback
logback-classic
可以正常启动。
原因是啥?
关键是使用 dependency Analyzer分析 ,提示的是 log4j-over-slf4j 的包
可能是因为:
logback 中包含多种版本的 日志包,会根据应用使用的不同连接对应版本。