Logging Spring using Log4j2

霸气de小男生 提交于 2019-11-30 08:12:58
Remko Popma

Looking at the dependencies in your pom, you have this one: slf4j-log4j12. This causes log statements against the slf4j api to be routed to the Log4j-1.2 implementation. You probably want these to be routed to the Log4j-2.0 implementation. Can you replace slf4j-log4j12 with log4j-slf4j-impl and try again?

This issue caused by spring use common-logging 1.X ,so if you want to have this logging routed to Log4j 2,you need add dependencies in your pom.xml

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-jcl</artifactId>
    <version>2.1</version>
 </dependency>

do not remove your common-logging 1.X dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!