You want to set up log4j for use in your web application.
Download the log4j distribution from the Apache Jakarta project and place the accompanying log4j-1.2.8.jar file (the name will be different for different log4j versions) in the WEB-INF/lib directory of your web application.
The log4j package is available for use under the Apache Software License, which is included with the distribution. Here are the steps for setting up log4j for your web application:
Go to the log4j web site and download the distribution in ZIP (Windows) or gzipped (Unix-based systems) format: http://jakarta.apache.org/log4j/docs/download.html. The downloaded file will be named something like jakarta-log4j-1.2.8.zip or jakarta-log4j-1.2.8.tar.gz.
Unpack the distribution, which creates a directory jakarta-log4j-1.2.8 (for Version 1.2.8 of log4j). Inside the dist directory of this top-level directory is the log4j-1.2.8.jar file. Copy this JAR file into the WEB-INF/lib directory of your web application(s).
Create a log4j properties file and place it in the web application's WEB-INF/classes directory. This is typically a text file with name/value pairs for configuring log4j elements such as loggers, appenders, and layouts. Recipe 14.4 includes an example of this file.
Example 14-2. Importing ...