evn: linux && intellij && openjdk 1.7 && tomcat 8
maven 配置:
org.apache.logging.log4j
log4j-api
2.0.1
org.apache.logging.log4j
log4j-core
2.0.1
org.apache.logging.log4j
log4j-slf4j-impl
2.0.1
此套配置在 tomcat 6,7 下能在终端输出,但是在tomcat8下终端无输出.
做过尝试
删除jcl-over-slf4j-1.7.6.jar ,但未能在tomcat8 下解决问题
从tomcat8的catalina.properties中的jarsToSkip属性 下移除 log4j.jar (slf4j.jar) ,仍未能解决
平台差异
此问题在我的linux才出现,window,mac测试没有这个问题
版本差异
同样的项目,在tomcat 7 下终端也有输出,且跟踪信息对比如下:
// tomcat 7
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).
log4j:WARN Please initialize the log4j system properly.
// tomcat 8
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.