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:
@@ -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 $
|
* $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.15 $
|
* $Revision: 1.16 $
|
||||||
* $Date: 2002/06/15 18:13:01 $
|
* $Date: 2002/11/23 03:49:40 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -77,7 +77,7 @@ import org.apache.commons.logging.impl.NoOpLog;
|
|||||||
* algorithm:</p>
|
* algorithm:</p>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>If Log4J is available, return an instance of
|
* <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
|
* <li>If JDK 1.4 or later is available, return an instance of
|
||||||
* <code>org.apache.commons.logging.impl.Jdk14Logger</code>.</li>
|
* <code>org.apache.commons.logging.impl.Jdk14Logger</code>.</li>
|
||||||
* <li>Otherwise, return an instance of
|
* <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
|
* implementation performs exactly the same algorithm as this class did
|
||||||
*
|
*
|
||||||
* @author Rod Waldhoff
|
* @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 {
|
public class LogSource {
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public class LogSource {
|
|||||||
|
|
||||||
// Is Log4J Available?
|
// Is Log4J Available?
|
||||||
try {
|
try {
|
||||||
if (null != Class.forName("org.apache.log4j.Category")) {
|
if (null != Class.forName("org.apache.log4j.Logger")) {
|
||||||
log4jIsAvailable = true;
|
log4jIsAvailable = true;
|
||||||
} else {
|
} else {
|
||||||
log4jIsAvailable = false;
|
log4jIsAvailable = false;
|
||||||
@@ -166,7 +166,7 @@ public class LogSource {
|
|||||||
try {
|
try {
|
||||||
if (log4jIsAvailable) {
|
if (log4jIsAvailable) {
|
||||||
setLogImplementation
|
setLogImplementation
|
||||||
("org.apache.commons.logging.impl.Log4JCategoryLog");
|
("org.apache.commons.logging.impl.Log4JLogger");
|
||||||
} else if (jdk14IsAvailable) {
|
} else if (jdk14IsAvailable) {
|
||||||
setLogImplementation
|
setLogImplementation
|
||||||
("org.apache.commons.logging.impl.Jdk14Logger");
|
("org.apache.commons.logging.impl.Jdk14Logger");
|
||||||
@@ -268,8 +268,8 @@ public class LogSource {
|
|||||||
* <p>
|
* <p>
|
||||||
* When <tt>org.apache.commons.logging.log</tt> is not set,
|
* When <tt>org.apache.commons.logging.log</tt> is not set,
|
||||||
* or when no corresponding class can be found,
|
* or when no corresponding class can be found,
|
||||||
* this method will return a Log4JCategoryLog
|
* this method will return a Log4JLogger
|
||||||
* if the log4j Category class is
|
* if the log4j Logger class is
|
||||||
* available in the {@link LogSource}'s classpath, or a
|
* available in the {@link LogSource}'s classpath, or a
|
||||||
* Jdk14Logger if we are on a JDK 1.4 or later system, or
|
* Jdk14Logger if we are on a JDK 1.4 or later system, or
|
||||||
* NoOpLog if neither of the above conditions is true.
|
* NoOpLog if neither of the above conditions is true.
|
||||||
|
|||||||
@@ -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 $
|
* $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.7 $
|
* $Revision: 1.8 $
|
||||||
* $Date: 2002/11/23 03:25:33 $
|
* $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
|
* Category instances should be done in the usual manner, as outlined in
|
||||||
* the Log4J documentation.</p>
|
* the Log4J documentation.</p>
|
||||||
*
|
*
|
||||||
|
* @deprecated Use {@link Log4JLogger} instead.
|
||||||
|
*
|
||||||
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @author Robert Burrell Donkin
|
* @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 {
|
public final class Log4JCategoryLog implements Log {
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ import org.apache.commons.logging.LogConfigurationException;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.commons.logging.LogSource;
|
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.
|
* <p>Concrete subclass of {@link LogFactory} specific to log4j.
|
||||||
@@ -137,7 +137,7 @@ public final class Log4jFactory extends LogFactory {
|
|||||||
if( instance != null )
|
if( instance != null )
|
||||||
return instance;
|
return instance;
|
||||||
|
|
||||||
instance=new Log4JCategoryLog( Category.getInstance( clazz ));
|
instance=new Log4JLogger( Logger.getLogger( clazz ));
|
||||||
instances.put( clazz, instance );
|
instances.put( clazz, instance );
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ public final class Log4jFactory extends LogFactory {
|
|||||||
if( instance != null )
|
if( instance != null )
|
||||||
return instance;
|
return instance;
|
||||||
|
|
||||||
instance=new Log4JCategoryLog( Category.getInstance( name ));
|
instance=new Log4JLogger( Logger.getLogger( name ));
|
||||||
instances.put( name, instance );
|
instances.put( name, instance );
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 $
|
* $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.19 $
|
* $Revision: 1.20 $
|
||||||
* $Date: 2002/11/23 03:07:58 $
|
* $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
|
* <li>Use the <code>org.apache.commons.logging.Log</code> system property
|
||||||
* to identify the requested implementation class.</li>
|
* to identify the requested implementation class.</li>
|
||||||
* <li>If <em>Log4J</em> is available, return an instance of
|
* <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
|
* <li>If <em>JDK 1.4 or later</em> is available, return an instance of
|
||||||
* <code>org.apache.commons.logging.impl.Jdk14Logger</code>.</li>
|
* <code>org.apache.commons.logging.impl.Jdk14Logger</code>.</li>
|
||||||
* <li>Otherwise, return an instance of
|
* <li>Otherwise, return an instance of
|
||||||
@@ -107,7 +107,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @author Craig R. McClanahan
|
* @author Craig R. McClanahan
|
||||||
* @author Richard A. Sitze
|
* @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 {
|
public class LogFactoryImpl extends LogFactory {
|
||||||
@@ -154,7 +154,7 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
|
|
||||||
|
|
||||||
private static final String LOG4JLOGIMPL =
|
private static final String LOG4JLOGIMPL =
|
||||||
"org.apache.commons.logging.impl.Log4JCategoryLog".intern();
|
"org.apache.commons.logging.impl.Log4JLogger".intern();
|
||||||
|
|
||||||
// ----------------------------------------------------- Instance Variables
|
// ----------------------------------------------------- Instance Variables
|
||||||
|
|
||||||
@@ -534,8 +534,8 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
protected boolean isLog4JAvailable() {
|
protected boolean isLog4JAvailable() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loadClass("org.apache.log4j.Category");
|
loadClass("org.apache.log4j.Logger");
|
||||||
loadClass("org.apache.commons.logging.impl.Log4JCategoryLog");
|
loadClass("org.apache.commons.logging.impl.Log4JLogger");
|
||||||
return (true);
|
return (true);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
return (false);
|
return (false);
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
can be used around a variety of different logging implementations, including
|
can be used around a variety of different logging implementations, including
|
||||||
prebuilt support for the following:</p>
|
prebuilt support for the following:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="http://jakarta.apache.org/log4j/">Log4J</a> from Apache's
|
<li><a href="http://jakarta.apache.org/log4j/">Log4J</a> (version 1.2 or later)
|
||||||
Jakarta project. Each named <a href="Log.html">Log</a> instance is
|
from Apache's Jakarta project. Each named <a href="Log.html">Log</a>
|
||||||
connected to a corresponding Log4J Category.</li>
|
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">
|
<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
|
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
|
<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>
|
<code>org.apache.commons.logging.Log</code>.</li>
|
||||||
<li>If the Log4J logging system is available in the application
|
<li>If the Log4J logging system is available in the application
|
||||||
class path, use the corresponding wrapper class
|
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
|
<li>If the application is executing on a JDK 1.4 system, use
|
||||||
the corresponding wrapper class
|
the corresponding wrapper class
|
||||||
(<a href="impl/Jdk14Logger.html">Jdk14Logger</a>).</li>
|
(<a href="impl/Jdk14Logger.html">Jdk14Logger</a>).</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user