The Jakarta-Log4J Project

The Jakarta-Log4j project (Log4J) is another open source project sponsored by the Apache Software Foundation. It was founded by Ceki Gulcu with the intention of providing application developers with a sophisticated—yet simple—logging mechanism that could be integrated into Java applications.

The Log4J project comprises three main components: Layouts, Appenders, and Categories.

We describe each of these components in the following sections. To follow the examples in this chapter, you need the latest archive of log4j, which can be found at http://jakarta.apache.org/log4j/.

Layouts

Layouts allow you to customize the output format of a Log4J message.

They must be assigned to Appenders, which are discussed in the following section.

The simplest of the Log4J Layouts is the SimpleLayout, which logs only the Priority and the message. To assign the SimpleLayout to an Appender, we could use something similar to the following code snippet:
log4j.appender.console.layout=org.apache.log4j.SimpleLayout

This line assigns a SimpleLayout to a previously defined Appender named console.

Log4 is pre-configured on our Tomcat hosting packages. You should take a look !

We discuss the appropriate location of Layout assignments in a subsequent section on configurators.

Output using the SimpleLayout would look similar to the following: DEBUG - This is the log message! You can find further documentation on the other Layouts packaged with Log4J.

 
Contact sales!