Compile and Run Program with Apache Log4j 1.x
How to compile and run my program with Log4j 1.x? My program uses Log4j API only and I want to know which JAR file is needed.
If your program is using Log4j 1.x API, you can compile and run the program with the only Log4j JAR file, like log4j-1.2.17.jar.
If you are using older versions of JDK, you may need to use older releases of Log4j 1.x JAR. See the JDK compatibility table below:
Release JDK Date ------- --- ---------- Apache Log4j 1.2.17 1.4 2012-05-06 Apache Log4j 1.2.16 1.1 2013-02-01 Apache Log4j 1.2.15 1.1 2007-08-30 Apache Log4j 1.2.1 1.1 2004-04-19 Apache Log4j 1.1.3 1.1 2004-04-19 Apache Log4j 1.0.4 1.1 2004-04-19
Here is a compilation and running session with the HelloLog4j.java program provided in the last tutorial.
fyicenter> java -version java version "1.7.0_45" fyicenter> javac -cp log4j-1.2.17.jar HelloLog4j.java fyicenter>java -cp .;log4j-1.2.17.jar HelloLog4j Logger class: org.apache.log4j.Logger 1 [main] FATAL HelloLog4j - Hello - fatal 3 [main] ERROR HelloLog4j - Hello - error 3 [main] WARN HelloLog4j - Hello - warn 4 [main] INFO HelloLog4j - Hello - info 4 [main] DEBUG HelloLog4j - Hello - debug
The above session shows that:
â‡‘â‡‘ FAQ for Apache Log4j
2015-12-11, 1648👍, 0💬
The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solut...
What Is mail.jar of JavaMail 1.4.1? I got the JAR file from javamail-1_4_1.zip. mail.jar in javamail...
Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles. ...
What Is log4j-1.2.15.jar? I got the JAR file from apache-log4j-1.2.15.zip. log4j-1.2.15.jar is the v...
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...