Problem
We have developed a maven based applications with Log4j2 and application are having multiple modules and dependencies added as jar in pom.xml. While running the application logs are generating for application only but log4j2 dependency logs are not showing for modules and dependent jars due to this causing problem in debugging or troubleshooting of application.
Solution
To resolve this log4j2 logs not displaying issue, the solution is to add Commons Logging Bridge dependency as below in your Maven pom.xml.
<dependencies>
...
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.1.17</version>
</dependency>
...
</dependencies>
As stated on the Apache Log4j web page:
If existing components use Apache Commons Logging 1.x and you want to have this logging routed to Log4j 2, then add the above dependency but do not remove any Commons Logging 1.x dependencies.
References
Related Posts
Your Feedback Motivate Us
If our FacingIssuesOnIT Experts solutions guide you to resolve your issues and improve your knowledge. Please share your comments, like and subscribe to get notifications for our posts.
Happy Learning !!!
You must log in to post a comment.