Java Log4J Installation Tutorial

The Apache Log4J logging utility is a must have for most Java programmers that need robust logging for Java application logging. Let’s go through a step by step tutorial from start to finish. There are a list of assumptions below that will be the basis for all of my tutorial steps.

Assumptions:

  • I am working in a windows environment.
  • I am developing all Java applications with Eclipse IDE.
  • I have 7-ZIP installed to unzip the archive.

Step 1 – Download log4j

  1. Go to Download Apache Log4j page.
  2. Click on the link apache-log4j-2.10.0-bin.zip for Apache Log4j 2 binary (zip).
  3. Click on the link from the suggested mirror site.

Step 2 – Save Zip File

  1. Save the zip file to your Downloads folder (Figure 1).
  2. Go to the Download folder and right click on the apache-log4j-2.10.0-bin archive.
  3. Select 7-ZIP and then Open Archive.

Step 3 – Copy and Extract

  1. Select log4j-api-2.10.0.jar and log4j-core-2.10.0.jar jar files (Figure 2).
  2. Click Extract.
  3. Copy these two jars to your lib or classpath directory (Figure 3).

Step 4 – Configure Eclipse

  1. Right Click on your Java Project >> Build Path >> Configure Build Path.
  2. Click on Add External Jars (Figure 4).
  3. Select log4j-api-2.10.0.jar and log4j-core-2.10.0.jar.
  4. Apply and Close.
  5. See Figure 5 for a screenshot of the log4j working library (Figure 6).

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Add a Comment

Your email address will not be published. Required fields are marked *