Logging Spring using Log4j2 Logging Spring using Log4j2 spring spring

Logging Spring using Log4j2


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


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?