log4j Tutorial 2, installation

Source: Internet
Author: User
Tags xml parser

LOG4J's API package uses Apache software licenses and is released under a fully fledged open source license certified by the Open Source Initiative.

The latest version of log4j, including full source code, class files and documentation can be found here http://logging.apache.org/log4j/.

Download apache-log4j-x.x.x.tar.gz to do the following:

Step 1:

Unzip and decompress the downloaded file in the/usr/local/directory as follows:

$ gunzip apache-log4j-1.2.15.tar.gz$ TAR-XVF apache-log4j-1.2.15.tarapache-log4j-1.2.15/tests/input/ apache-log4j-1.2.15/tests/input/xml/apache-log4j-1.2.15/tests/src/apache-log4j-1.2.15/tests/src/java/ apache-log4j-1.2.15/tests/src/java/org/....... .......................

When performing an extract, this creates a name for the apache-log4j-x.x.x directory hierarchy as follows:

-rw-r--r--1Root root3565  -- ,- - xx: thebuild-INFO.txt-rw-r--r--1Root root2607  -- ,- - xx: theBuild.properties.sample-rw-r--r--1Root root32619  -- ,- - xx: theBUILD.XMLDRWXR-xr-x -Root root4096  .- Geneva-Geneva  -: theCONTRIBSDRWXR-xr-x5Root root4096  .- Geneva-Geneva  -: theexamples-rw-r--r--1Root root2752  -- ,- - xx: theINSTALL-rw-r--r--1Root root4787  -- ,- - xx: theKEYS-rw-r--r--1Root root11366  -- ,- - xx: theLICENSE-rw-r--r--1Root root391834  -- ,- - xx: inlog4j-1.2. the. Jar-rw-r--r--1Root root the  -- ,- - xx: theNOTICE-rwxr-xr-x1Root root10240  -- ,- - xx: -NTEventLogAppender.dll-rw-r--r--1Root root17780  -- ,- - xx: thePOM.XMLDRWXR-xr-x7Root root4096  -- ,- - xx: -SITEDRWXR-xr-x8Root root4096  .- Geneva-Geneva  -: ,SRCDRWXR-xr-x6Root root4096  .- Geneva-Geneva  -: theTests

Step 2:

This step is optional and depends on what features you want to use the LOG4J framework. If you already have the following installed on your machine, then you can use these packages, otherwise you will need to install them to properly make log4j work

    • JavaMail API: E-mail. The LOG4J logging feature requires the Java Mail API (Mail.jar) to be installed on the computer https://glassfish.dev.java.net/javaee5/mail/

    • JavaBeans Active Framework: the Java Mail API also requires the JavaBeans Activation Framework (Activation.jar) from http://java.sun.com/products/javabeans/jaf/index.jsp Download and install on your computer

    • Java Information Services: LOG4J's JMS-compatible features will require two JMS and Jndi (Java naming and directory interfaces) that can be downloaded from the HTTP://JAVA.SUN.COM/PRODUCTS/JMS installation

    • XML Parser: Requires a JAXP-compatible XML parser to use log4j. Make sure you have Xerces.jar installed on your machine and can download and install from http://xerces.apache.org/xerces-j/install.html

Step 3:

This step is very important and you need to set the classpath and path variables correctly. Here to set just the Log4j.x.x.x.jar file

pwd/usr/local/apache-log4j-1.2.  the $ export CLASSPATH=       $CLASSPATH:/usr/local/apache-log4j-1.2.  /log4j-1.2.  the . jar$ export PATH= $PATH:/usr/local/apache-log4j-1.2. /
View Code


Note: If you are developing with Eclipse on window, you can create a user library in Eclipse and add it to the build path.

log4j Tutorial 2, installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.