Log4j

 
 
Log4j is a package to output log statements to a variety of output targets.

The log statements can remain in your shipped code without incurring a heavy performance cost. The logging behavior can be controlled by editing a configuration file (log4j.properties), without modifying the application.

One of the distinctive features of log4j is the notion of inheritance in loggers. By using a logger hierarchy it is possible to control which log statements are output at arbitrarily fine granularity. This helps reduce the volume of logged output and minimize the cost of logging.

The target of the log output can be a file, an OutputStream, a java.io.Writer, a remote log4j server, a remote Unix Syslog daemon, or even a NT Event logger among many other output targets.

Log4j has three main components (loggers, appenders and layouts) which works together to enable developers to log messages according to message type and level, and to control at runtime how these messages are formatted and where they are reported.

Log4j is distributed at no charge for commercial or non-commercial use. For more information read the LICENSE.txt file.

More information about log4j can be found at http://logging.apache.org/log4j/docs/index.html

The latest Log4j version can be downloaded from http://logging.apache.org/log4j/docs/download.html

rss feed






Debug log4j.



Information
none

Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
Log4j 1.2.9


Procedure
  1. To determine what log4j is doing add the following line to your java runtime command:

    -Dlog4j.debug=true

    For example you are using log4j in your web application deployed on Tomcat.
    Add the above mentioned line in the java runtime command to start up Tomcat:

    C:\Tools\java\j2sdk1.4.2_01\bin\java.exe -jar
    -Duser.dir="C:\Tools\Tomcat 4.1"
    -Dlog4j.debug=true
    -Djava.endorsed.dirs="C:\Tools\Tomcat 4.1\common\endorsed"
    "C:\Tools\Tomcat 4.1\bin\bootstrap.jar" start