Configuring log4j2 and log4j using a single log4j2 xml file

I would recommend using the log4j-1.2 adapter that is included in the log4j2 distribution. That way, any libraries coded to the log4j-1.2 API will work with log4j2 without any code changes.

Your classpath should include:

  • log4j-api-2.6.1.jar
  • log4j-core-2.6.1.jar
  • log4j-1.2-api-2.6.1.jar
  • log4j2.xml

Your classpath should not include:

  • log4j-1.2.x.jar
  • log4j.properties or log4j.xml (these will be ignored by log4j2 anyway)

See also http://logging.apache.org/log4j/2.x/faq.html#which_jars

Leave a Comment