O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A log4j Code Example

The following code example demonstrates the process for using logging with the log4j package. This program begins by importing the org.apache.log4j package. This package is not part of the standard JDK and must be downloaded from the Jakarta/Apache site (http://jakarta.apache.org/log4j). Within the package downloaded is a JAR file (for version 1.2, it is named log4j-1.2.jar) that must be made visible to the Java Runtime Environment (JRE) of the application using the package (in the classpath or in the $JAVA_HOME/jre/lib/ext directory).

This code example loads the log4j configuration using a URL (in string format), which is used to set the value of the log4j.configuration System property. This value could also have been set ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required