| |
| =========== |
| Using log4j |
| =========== |
| |
| 1) First untar the distribution file. |
| |
| 2) Assuming you chose to extract the distribution in to the |
| PATH_OF_YOUR_CHOICE, untarring the distribution file should create |
| a log4j-vXX directory, where XX is the log4j version number, under |
| PATH_OF_YOUR_CHOICE. |
| |
| |
| 3) Add PATH_OF_YOUR_CHOICE\log4j-vXXX\classes to the CLASSPATH |
| variable. |
| |
| 4) You can now test your installation. To do this issue the command: |
| |
| java org.log4j.test.Hello |
| |
| You should see log statements appearing on the console. |
| |
| 5) Refer to the javadoc documentation and the user manual on how to |
| include log statements into your own code. |
| |
| ========= |
| JAR files |
| ========= |
| |
| The log4j distribution comes with two jar files: log4j-core.jar and |
| log4j.jar. |
| |
| The first jar file contains the classes you need to use the package to |
| print to a file or the console. The second jar file, in addition to |
| the code contained in the first file, contains classes to interact |
| with a Syslog daemon and code to output/receive log statements using |
| TCP sockets plus all sort of other goodies. |
| |
| ================== |
| log4j dependencies |
| ================== |
| |
| |
| The log4j distribution comes with pre-compiled classes. Log4j is based |
| on JDK 1.1 with the following exceptions: |
| |
| --------------------- |
| Package org.log4j.xml |
| --------------------- |
| |
| The DOMConfigurator is based on the DOM Level 1 API. The |
| DOMConfigurator.configure(Element) method will work with any |
| XML parser that will pass it a DOM tree. |
| |
| The DOMConfigurator.configure(String filename) method and its variants |
| require a JAXP compatible XMLparser, for example the Apache Xerces |
| parser. Compiling the DOMConfigurator requires the presence of a |
| JAXP parser in the classpath. |
| |
| ------------ |
| SMTPAppender |
| ------------ |
| |
| The SMTPAppender relies on the JavaMail API. It has been tested with |
| JavaMail API version 1.2. The JavaMail API requires the |
| JavaBeans Activation Framework package. You can download the JavaMail API at: |
| |
| http://java.sun.com/products/javamail/ |
| |
| and the JavaBeans Activation Framework at: |
| |
| http://java.sun.com/beans/glasgow/jaf.html |
| |
| ----------- |
| JMSAppender |
| ----------- |
| |
| The JMSAppender requires the JMS API as well as JNDI. |
| |
| ---------------- |
| TextPaneAppender |
| ---------------- |
| |
| The TextPaneAppender is based on Swing. |
| |
| ----------------------- |
| JUnit testing framework |
| ----------------------- |
| |
| Log4j uses the JUnit framework for internal unit testing. If you |
| want to compile all log4j source code, then you will need |
| JUnit. JUnit is available from: |
| |
| http://www.junit.org |
| |
| ============== |
| Building log4j |
| ============== |
| |
| Like most java appilicatios today, log4j relies on ANT as its build |
| tool. ANT is availale from "http://jakarta.apache.org/ant/index.html". |
| ANT requires a build file called build.xml which is part of this |
| distribution. |
| |
| Alternatively, you might wish to use the GNU-Make build/compile |
| environment included with the package. In that case, you need to |
| create a make.loc file in the make directory. See the files |
| make/README and make/TUTORIAL for further details. |
| |
| In case of problems please contact "Ceki Gulcu" <ceki@apache.org>. |