Including Apache Log4j JAR Files in Classpath

Q

Which JAR files should I use from the Log2j binary package to run my program? There are so many JAR files in the package.

✍: FYIcenter.com

A

Yes, there are about 40 JAR files in the Log2j 2 binary package. But you should follow the these guidelines to determine which JAR files are needed to run your program:

  • log4j-api-*.jar and log4j-core-*.jar are required JAR files. You must include them in the classpath to run your program.
  • log4j-*-sources.jar files are Java source files for different modules. No need to include them to run your program.
  • log4j-*-javadoc.jar files are Javadoc files for different modules. No need to include them to run your program.
  • log4j-*-tests.jar file is for testing purpose. No need to include it to run your program.
  • Other JAR files are optional modules. You need to include them, only if you are using them. For example, if some parts of your application are also using Log4j 1.2 API, you need to include log4j-1.2-api-*.jar to run your programs.

 

⇒ Hello Program with Apache Log4j

⇐ Using Apache Log4j in Java Programs

⇑ Using Apache Log4j in Java Programs

⇑⇑ FAQ for Apache Log4j

2015-11-18, 1695👍, 0💬