Mixing log4j 1.x and log4j 2

Are you aware that log4j2 includes a bridge for log4j-1.2? You can use it by removing the old log4j-1.2.17.jar, and include these three jars:

  • log4j-api-2.x.jar
  • log4j-core-2.x.jar
  • log4j-1.2-api-2.x.jar

This will result in all calls that your application makes to the log4-1.2 API to be routed to the log4j2 implementation. The FAQ has a diagram that may clarify things. (Don’t forget to remove the old log4j-1.2 jar from the classpath!)

Leave a Comment

tech