[logback-dev] svn commit: r1088 - in logback/trunk: log4j-bridge/compatibility log4j-bridge/compatibility/src/main/java/test log4j-bridge/src/test/java/org/apache/log4j logback-site/src/site/xdocTemplates
noreply.seb at qos.ch
noreply.seb at qos.ch
Fri Dec 15 15:03:28 CET 2006
Author: seb
Date: Fri Dec 15 15:03:28 2006
New Revision: 1088
Added:
logback/trunk/log4j-bridge/compatibility/readme.txt
logback/trunk/logback-site/src/site/xdocTemplates/bridge.xml
Modified:
logback/trunk/log4j-bridge/compatibility/build.xml
logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j12Calls.java
logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j13Calls.java
logback/trunk/log4j-bridge/src/test/java/org/apache/log4j/InvokeLog4jTest.java
logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml
Log:
Minor improvements on the log4j-bridge module
Added a documentation page to explain how to use and test the module
Added a read me file to direct the user to the web page
Modified: logback/trunk/log4j-bridge/compatibility/build.xml
==============================================================================
--- logback/trunk/log4j-bridge/compatibility/build.xml (original)
+++ logback/trunk/log4j-bridge/compatibility/build.xml Fri Dec 15 15:03:28 2006
@@ -77,9 +77,9 @@
<!-- ================================================================= -->
<!-- Run tests -->
<!-- ================================================================= -->
- <target name="all" depends="test1, test2" />
+ <target name="all" depends="test12, test13" />
- <target name="test1" depends="build_log4j12">
+ <target name="test12" depends="build_log4j12">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="log4-bridge.classpath" />
<classpath location="${javac.dest.12}" />
@@ -88,7 +88,7 @@
</junit>
</target>
- <target name="test2" depends="build_log4j13">
+ <target name="test13" depends="build_log4j13">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="log4-bridge.classpath" />
<classpath location="${javac.dest.13}" />
Added: logback/trunk/log4j-bridge/compatibility/readme.txt
==============================================================================
--- (empty file)
+++ logback/trunk/log4j-bridge/compatibility/readme.txt Fri Dec 15 15:03:28 2006
@@ -0,0 +1,12 @@
+#--------------------------#
+| |
+| Log4j-bridge Read-me |
+| |
+#--------------------------#
+
+This directory contains the compatibility tests of the log4j-bridge module.
+
+They use two test cases, one for log4j 1.2 calls, and one for log4j 1.3 calls.
+
+To obtain more information about this directory, or the use of the log4j-bridge
+module and its tests, please visit http://logback.qos.ch/bridge.html
\ No newline at end of file
Modified: logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j12Calls.java
==============================================================================
--- logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j12Calls.java (original)
+++ logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j12Calls.java Fri Dec 15 15:03:28 2006
@@ -1,3 +1,12 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ *
+ * Copyright (C) 1999-2006, QOS.ch
+ *
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
package test;
import junit.framework.TestCase;
@@ -5,6 +14,14 @@
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
+/**
+ *
+ * A test case that issues the typical calls
+ * that an application using log4j 1.2 would do.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
public class Log4j12Calls extends TestCase {
public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
Modified: logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j13Calls.java
==============================================================================
--- logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j13Calls.java (original)
+++ logback/trunk/log4j-bridge/compatibility/src/main/java/test/Log4j13Calls.java Fri Dec 15 15:03:28 2006
@@ -1,3 +1,13 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ *
+ * Copyright (C) 1999-2006, QOS.ch
+ *
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
+
package test;
import junit.framework.TestCase;
@@ -5,6 +15,15 @@
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
+/**
+ *
+ * A test case that issues the typical calls
+ * that an application using log4j 1.3 would do.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+
public class Log4j13Calls extends TestCase {
public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
Modified: logback/trunk/log4j-bridge/src/test/java/org/apache/log4j/InvokeLog4jTest.java
==============================================================================
--- logback/trunk/log4j-bridge/src/test/java/org/apache/log4j/InvokeLog4jTest.java (original)
+++ logback/trunk/log4j-bridge/src/test/java/org/apache/log4j/InvokeLog4jTest.java Fri Dec 15 15:03:28 2006
@@ -46,7 +46,6 @@
public class InvokeLog4jTest extends TestCase {
public void testIsEnabledAPI() {
- // assume that we are running over slf4j-simple
Logger log = Logger.getLogger(InvokeLog4jTest.class.getName());
assertTrue(log.isTraceEnabled());
Added: logback/trunk/logback-site/src/site/xdocTemplates/bridge.xml
==============================================================================
--- (empty file)
+++ logback/trunk/logback-site/src/site/xdocTemplates/bridge.xml Fri Dec 15 15:03:28 2006
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<document>
+
+ <properties>
+ <author email="ceki at qos ddoott ch ">Ceki Gulcu</author>
+ <author email="sebastien at qos ddoott ch ">Sebastien Pennec</author>
+ <title>Log4j Bridge</title>
+ </properties>
+
+ <body>
+
+ <h2>Log4j bridge</h2>
+
+ <p>
+ As of version 0.7, logback ships with a new module called <em>log4j-bridge</em>.
+ It allows log4j users to use logback without changing a single line of code in
+ their application. All that is needed to do is to replace the log4j.jar file
+ with the appropriate logback jars.
+ </p>
+
+ <h3>How does it work?</h3>
+ <p>
+ The log4j-bridge module contains new implementations of the most widely used
+ log4j classes, namely <code>Category</code>, <code>Level</code>, <code>Logger</code>,
+ <code>MDC</code> and <code>Priority</code>, as well as <code>Log4jLoggerFactory</code>.
+ All these implementations redirect the calls to the corresponding logback class.
+ </p>
+ <p>
+ To use the bridge in your own application, the first step is to locate and remove
+ the log4j.jar file. Then you should place the following jars in your application's
+ classpath:
+ </p>
+
+ <ul>
+ <li>
+ log4j-bridge-<em>VERSION</em>.jar
+ </li>
+ <li>
+ logback-classic-<em>VERSION</em>.jar
+ </li>
+ <li>
+ logback-core-<em>VERSION</em>.jar
+ </li>
+ <li>
+ slf4j-api-<em>VERSION</em>.jar
+ </li>
+ </ul>
+
+ <p>
+ This is what it takes to make logback your logging implementation when using log4j.
+ It will use logback's automatic basic configuration, displaying the logging requests
+ in the console. More advanced use will require a configuration file and other jars
+ which are logback dependencies. In that case, a file called <em>logback.xml</em>,
+ placed in the application's classpath, will be automatically loaded by logback.
+ </p>
+
+ <h3>Running the log4j-bridge tests</h3>
+ <p>
+ The log4j-bridge module contains a <em>compatibility</em> directory that is used to
+ test the module against various log4j calls. Two test cases simulate the typical calls
+ that one can find in an application that uses either log4j 1.2.x, or log4j 1.3.x.
+ </p>
+ <p>
+ In the same directory is a <em>build.xml</em> file that uses ant to
+ compile the test cases with the corresponding log4j version,
+ and to runs these tests without log4j in the classpath but with
+ logback jars instead.
+ </p>
+
+ <p>
+ To run the tests, one must have ant installed. Issuing the following command,
+ once in the <em>compatibility</em> directory will launch the tests:
+ </p>
+
+<div class="source"><pre>ant all</pre></div>
+
+ </body>
+</document>
\ No newline at end of file
Modified: logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml (original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml Fri Dec 15 15:03:28 2006
@@ -31,6 +31,9 @@
<li>
<a href="faq.html">A Frequently Asked Questions list (FAQ)</a>
</li>
+ <li>
+ <a href="bridge.html">How to: use and test the log4j bridge</a>
+ </li>
</ul>
<p>Source code related documentation:</p>
More information about the logback-dev
mailing list