1
0

Deprecte Log4JCategoryLog (because Log4J has deprecated o.a.l.Category),

and replace it with a new Log4JLogger implementation that wraps an
o.a.l.Logger instance instead.

Update docco to reflect that Log4J support is now for version 1.2 or later
(when o.a.l.Logger was introduced).

PR:  13118
Submitted by:  Paul Campbell <seapwc at halycon.com>


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138940 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Craig R. McClanahan
2002-11-23 03:49:40 +00:00
parent e0be9b7850
commit 2783ad6bc1
5 changed files with 30 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/LogSource.java,v 1.15 2002/06/15 18:13:01 craigmcc Exp $
* $Revision: 1.15 $
* $Date: 2002/06/15 18:13:01 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/LogSource.java,v 1.16 2002/11/23 03:49:40 craigmcc Exp $
* $Revision: 1.16 $
* $Date: 2002/11/23 03:49:40 $
*
* ====================================================================
*
@@ -77,7 +77,7 @@ import org.apache.commons.logging.impl.NoOpLog;
* algorithm:</p>
* <ul>
* <li>If Log4J is available, return an instance of
* <code>org.apache.commons.logging.impl.Log4JCategoryLog</code>.</li>
* <code>org.apache.commons.logging.impl.Log4JLogger</code>.</li>
* <li>If JDK 1.4 or later is available, return an instance of
* <code>org.apache.commons.logging.impl.Jdk14Logger</code>.</li>
* <li>Otherwise, return an instance of
@@ -97,7 +97,7 @@ import org.apache.commons.logging.impl.NoOpLog;
* implementation performs exactly the same algorithm as this class did
*
* @author Rod Waldhoff
* @version $Id: LogSource.java,v 1.15 2002/06/15 18:13:01 craigmcc Exp $
* @version $Id: LogSource.java,v 1.16 2002/11/23 03:49:40 craigmcc Exp $
*/
public class LogSource {
@@ -121,7 +121,7 @@ public class LogSource {
// Is Log4J Available?
try {
if (null != Class.forName("org.apache.log4j.Category")) {
if (null != Class.forName("org.apache.log4j.Logger")) {
log4jIsAvailable = true;
} else {
log4jIsAvailable = false;
@@ -166,7 +166,7 @@ public class LogSource {
try {
if (log4jIsAvailable) {
setLogImplementation
("org.apache.commons.logging.impl.Log4JCategoryLog");
("org.apache.commons.logging.impl.Log4JLogger");
} else if (jdk14IsAvailable) {
setLogImplementation
("org.apache.commons.logging.impl.Jdk14Logger");
@@ -268,8 +268,8 @@ public class LogSource {
* <p>
* When <tt>org.apache.commons.logging.log</tt> is not set,
* or when no corresponding class can be found,
* this method will return a Log4JCategoryLog
* if the log4j Category class is
* this method will return a Log4JLogger
* if the log4j Logger class is
* available in the {@link LogSource}'s classpath, or a
* Jdk14Logger if we are on a JDK 1.4 or later system, or
* NoOpLog if neither of the above conditions is true.

View File

@@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Attic/Log4JCategoryLog.java,v 1.7 2002/11/23 03:25:33 craigmcc Exp $
* $Revision: 1.7 $
* $Date: 2002/11/23 03:25:33 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Attic/Log4JCategoryLog.java,v 1.8 2002/11/23 03:49:40 craigmcc Exp $
* $Revision: 1.8 $
* $Date: 2002/11/23 03:49:40 $
*
* ====================================================================
*
@@ -72,10 +72,12 @@ import java.util.Enumeration;
* Category instances should be done in the usual manner, as outlined in
* the Log4J documentation.</p>
*
* @deprecated Use {@link Log4JLogger} instead.
*
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
* @author Rod Waldhoff
* @author Robert Burrell Donkin
* @version $Id: Log4JCategoryLog.java,v 1.7 2002/11/23 03:25:33 craigmcc Exp $
* @version $Id: Log4JCategoryLog.java,v 1.8 2002/11/23 03:49:40 craigmcc Exp $
*/
public final class Log4JCategoryLog implements Log {

View File

@@ -68,7 +68,7 @@ import org.apache.commons.logging.LogConfigurationException;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.LogSource;
import org.apache.log4j.Category;
import org.apache.log4j.Logger;
/**
* <p>Concrete subclass of {@link LogFactory} specific to log4j.
@@ -137,7 +137,7 @@ public final class Log4jFactory extends LogFactory {
if( instance != null )
return instance;
instance=new Log4JCategoryLog( Category.getInstance( clazz ));
instance=new Log4JLogger( Logger.getLogger( clazz ));
instances.put( clazz, instance );
return instance;
}
@@ -150,7 +150,7 @@ public final class Log4jFactory extends LogFactory {
if( instance != null )
return instance;
instance=new Log4JCategoryLog( Category.getInstance( name ));
instance=new Log4JLogger( Logger.getLogger( name ));
instances.put( name, instance );
return instance;
}

View File

@@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.19 2002/11/23 03:07:58 craigmcc Exp $
* $Revision: 1.19 $
* $Date: 2002/11/23 03:07:58 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.20 2002/11/23 03:49:40 craigmcc Exp $
* $Revision: 1.20 $
* $Date: 2002/11/23 03:49:40 $
*
* ====================================================================
*
@@ -86,7 +86,7 @@ import org.apache.commons.logging.LogFactory;
* <li>Use the <code>org.apache.commons.logging.Log</code> system property
* to identify the requested implementation class.</li>
* <li>If <em>Log4J</em> is available, return an instance of
* <code>org.apache.commons.logging.impl.Log4JCategoryLog</code>.</li>
* <code>org.apache.commons.logging.impl.Log4JLogger</code>.</li>
* <li>If <em>JDK 1.4 or later</em> is available, return an instance of
* <code>org.apache.commons.logging.impl.Jdk14Logger</code>.</li>
* <li>Otherwise, return an instance of
@@ -107,7 +107,7 @@ import org.apache.commons.logging.LogFactory;
* @author Rod Waldhoff
* @author Craig R. McClanahan
* @author Richard A. Sitze
* @version $Revision: 1.19 $ $Date: 2002/11/23 03:07:58 $
* @version $Revision: 1.20 $ $Date: 2002/11/23 03:49:40 $
*/
public class LogFactoryImpl extends LogFactory {
@@ -154,7 +154,7 @@ public class LogFactoryImpl extends LogFactory {
private static final String LOG4JLOGIMPL =
"org.apache.commons.logging.impl.Log4JCategoryLog".intern();
"org.apache.commons.logging.impl.Log4JLogger".intern();
// ----------------------------------------------------- Instance Variables
@@ -534,8 +534,8 @@ public class LogFactoryImpl extends LogFactory {
protected boolean isLog4JAvailable() {
try {
loadClass("org.apache.log4j.Category");
loadClass("org.apache.commons.logging.impl.Log4JCategoryLog");
loadClass("org.apache.log4j.Logger");
loadClass("org.apache.commons.logging.impl.Log4JLogger");
return (true);
} catch (Throwable t) {
return (false);

View File

@@ -7,9 +7,9 @@
can be used around a variety of different logging implementations, including
prebuilt support for the following:</p>
<ul>
<li><a href="http://jakarta.apache.org/log4j/">Log4J</a> from Apache's
Jakarta project. Each named <a href="Log.html">Log</a> instance is
connected to a corresponding Log4J Category.</li>
<li><a href="http://jakarta.apache.org/log4j/">Log4J</a> (version 1.2 or later)
from Apache's Jakarta project. Each named <a href="Log.html">Log</a>
instance is connected to a corresponding Log4J Logger.</li>
<li><a href="http://java.sun.com/j2se/1.4/docs/guide/util/logging/index.html">
JDK Logging API</a>, included in JDK 1.4 or later systems. Each named
<a href="Log.html">Log</a> instance is connected to a corresponding
@@ -127,7 +127,7 @@ implementation uses the following rules:</p>
<code>org.apache.commons.logging.Log</code>.</li>
<li>If the Log4J logging system is available in the application
class path, use the corresponding wrapper class
(<a href="impl/Log4JCategoryLog.html">Log4JCategoryLog</a>).</li>
(<a href="impl/Log4JLogger.html">Log4JLogger</a>).</li>
<li>If the application is executing on a JDK 1.4 system, use
the corresponding wrapper class
(<a href="impl/Jdk14Logger.html">Jdk14Logger</a>).</li>