Fixes for typos and speiling mistakes in the javadocs Contributed by Dennis Lundberg.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@139007 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/Log.java,v 1.16 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/Log.java,v 1.17 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.16 $
|
* $Revision: 1.17 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -102,7 +102,7 @@ package org.apache.commons.logging;
|
|||||||
*
|
*
|
||||||
* @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
|
||||||
* @version $Id: Log.java,v 1.16 2003/10/09 21:37:47 rdonkin Exp $
|
* @version $Id: Log.java,v 1.17 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
*/
|
*/
|
||||||
public interface Log {
|
public interface Log {
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ public interface Log {
|
|||||||
* <p> Is debug logging currently enabled? </p>
|
* <p> Is debug logging currently enabled? </p>
|
||||||
*
|
*
|
||||||
* <p> Call this method to prevent having to perform expensive operations
|
* <p> Call this method to prevent having to perform expensive operations
|
||||||
* (for example, <code>String</code> concatination)
|
* (for example, <code>String</code> concatenation)
|
||||||
* when the log level is more than debug. </p>
|
* when the log level is more than debug. </p>
|
||||||
*/
|
*/
|
||||||
public boolean isDebugEnabled();
|
public boolean isDebugEnabled();
|
||||||
@@ -124,7 +124,7 @@ public interface Log {
|
|||||||
* <p> Is error logging currently enabled? </p>
|
* <p> Is error logging currently enabled? </p>
|
||||||
*
|
*
|
||||||
* <p> Call this method to prevent having to perform expensive operations
|
* <p> Call this method to prevent having to perform expensive operations
|
||||||
* (for example, <code>String</code> concatination)
|
* (for example, <code>String</code> concatenation)
|
||||||
* when the log level is more than error. </p>
|
* when the log level is more than error. </p>
|
||||||
*/
|
*/
|
||||||
public boolean isErrorEnabled();
|
public boolean isErrorEnabled();
|
||||||
@@ -134,7 +134,7 @@ public interface Log {
|
|||||||
* <p> Is fatal logging currently enabled? </p>
|
* <p> Is fatal logging currently enabled? </p>
|
||||||
*
|
*
|
||||||
* <p> Call this method to prevent having to perform expensive operations
|
* <p> Call this method to prevent having to perform expensive operations
|
||||||
* (for example, <code>String</code> concatination)
|
* (for example, <code>String</code> concatenation)
|
||||||
* when the log level is more than fatal. </p>
|
* when the log level is more than fatal. </p>
|
||||||
*/
|
*/
|
||||||
public boolean isFatalEnabled();
|
public boolean isFatalEnabled();
|
||||||
@@ -144,7 +144,7 @@ public interface Log {
|
|||||||
* <p> Is info logging currently enabled? </p>
|
* <p> Is info logging currently enabled? </p>
|
||||||
*
|
*
|
||||||
* <p> Call this method to prevent having to perform expensive operations
|
* <p> Call this method to prevent having to perform expensive operations
|
||||||
* (for example, <code>String</code> concatination)
|
* (for example, <code>String</code> concatenation)
|
||||||
* when the log level is more than info. </p>
|
* when the log level is more than info. </p>
|
||||||
*/
|
*/
|
||||||
public boolean isInfoEnabled();
|
public boolean isInfoEnabled();
|
||||||
@@ -154,7 +154,7 @@ public interface Log {
|
|||||||
* <p> Is trace logging currently enabled? </p>
|
* <p> Is trace logging currently enabled? </p>
|
||||||
*
|
*
|
||||||
* <p> Call this method to prevent having to perform expensive operations
|
* <p> Call this method to prevent having to perform expensive operations
|
||||||
* (for example, <code>String</code> concatination)
|
* (for example, <code>String</code> concatenation)
|
||||||
* when the log level is more than trace. </p>
|
* when the log level is more than trace. </p>
|
||||||
*/
|
*/
|
||||||
public boolean isTraceEnabled();
|
public boolean isTraceEnabled();
|
||||||
@@ -164,8 +164,8 @@ public interface Log {
|
|||||||
* <p> Is warning logging currently enabled? </p>
|
* <p> Is warning logging currently enabled? </p>
|
||||||
*
|
*
|
||||||
* <p> Call this method to prevent having to perform expensive operations
|
* <p> Call this method to prevent having to perform expensive operations
|
||||||
* (for example, <code>String</code> concatination)
|
* (for example, <code>String</code> concatenation)
|
||||||
* when the log level is more than warning. </p>
|
* when the log level is more than warn. </p>
|
||||||
*/
|
*/
|
||||||
public boolean isWarnEnabled();
|
public boolean isWarnEnabled();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/LogFactory.java,v 1.24 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/LogFactory.java,v 1.25 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.24 $
|
* $Revision: 1.25 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -87,7 +87,7 @@ import java.util.Properties;
|
|||||||
* @author Craig R. McClanahan
|
* @author Craig R. McClanahan
|
||||||
* @author Costin Manolache
|
* @author Costin Manolache
|
||||||
* @author Richard A. Sitze
|
* @author Richard A. Sitze
|
||||||
* @version $Revision: 1.24 $ $Date: 2003/10/09 21:37:47 $
|
* @version $Revision: 1.25 $ $Date: 2004/02/28 17:54:14 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class LogFactory {
|
public abstract class LogFactory {
|
||||||
@@ -189,7 +189,7 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Release any internal references to previously created {@link Log}
|
* Release any internal references to previously created {@link Log}
|
||||||
* instances returned by this factory. This is useful environments
|
* instances returned by this factory. This is useful in environments
|
||||||
* like servlet containers, which implement application reloading by
|
* like servlet containers, which implement application reloading by
|
||||||
* throwing away a ClassLoader. Dangling references to objects in that
|
* throwing away a ClassLoader. Dangling references to objects in that
|
||||||
* class loader would prevent garbage collection.
|
* class loader would prevent garbage collection.
|
||||||
@@ -273,8 +273,8 @@ public abstract class LogFactory {
|
|||||||
return factory;
|
return factory;
|
||||||
|
|
||||||
|
|
||||||
// Load properties file..
|
// Load properties file.
|
||||||
// will be used one way or another in the end.
|
// Will be used one way or another in the end.
|
||||||
|
|
||||||
Properties props=null;
|
Properties props=null;
|
||||||
try {
|
try {
|
||||||
@@ -305,7 +305,7 @@ public abstract class LogFactory {
|
|||||||
// Second, try to find a service by using the JDK1.3 jar
|
// Second, try to find a service by using the JDK1.3 jar
|
||||||
// discovery mechanism. This will allow users to plug a logger
|
// discovery mechanism. This will allow users to plug a logger
|
||||||
// by just placing it in the lib/ directory of the webapp ( or in
|
// by just placing it in the lib/ directory of the webapp ( or in
|
||||||
// CLASSPATH or equivalent ). This is similar with the second
|
// CLASSPATH or equivalent ). This is similar to the second
|
||||||
// step, except that it uses the (standard?) jdk1.3 location in the jar.
|
// step, except that it uses the (standard?) jdk1.3 location in the jar.
|
||||||
|
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
@@ -362,7 +362,7 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
if (factory != null) {
|
if (factory != null) {
|
||||||
/**
|
/**
|
||||||
* Always cache using context class loader..
|
* Always cache using context class loader.
|
||||||
*/
|
*/
|
||||||
cacheFactory(contextClassLoader, factory);
|
cacheFactory(contextClassLoader, factory);
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ public abstract class LogFactory {
|
|||||||
* Convenience method to return a named logger, without the application
|
* Convenience method to return a named logger, without the application
|
||||||
* having to care about factories.
|
* having to care about factories.
|
||||||
*
|
*
|
||||||
* @param clazz Class for which a log name will be derived
|
* @param clazz Class from which a log name will be derived
|
||||||
*
|
*
|
||||||
* @exception LogConfigurationException if a suitable <code>Log</code>
|
* @exception LogConfigurationException if a suitable <code>Log</code>
|
||||||
* instance cannot be returned
|
* instance cannot be returned
|
||||||
@@ -440,7 +440,7 @@ public abstract class LogFactory {
|
|||||||
/**
|
/**
|
||||||
* Release any internal references to previously created {@link LogFactory}
|
* Release any internal references to previously created {@link LogFactory}
|
||||||
* instances, after calling the instance method <code>release()</code> on
|
* instances, after calling the instance method <code>release()</code> on
|
||||||
* each of them. This is useful environments like servlet containers,
|
* each of them. This is useful in environments like servlet containers,
|
||||||
* which implement application reloading by throwing away a ClassLoader.
|
* which implement application reloading by throwing away a ClassLoader.
|
||||||
* Dangling references to objects in that class loader would prevent
|
* Dangling references to objects in that class loader would prevent
|
||||||
* garbage collection.
|
* garbage collection.
|
||||||
@@ -523,7 +523,7 @@ public abstract class LogFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check cached factories (keyed by classLoader)
|
* Check cached factories (keyed by contextClassLoader)
|
||||||
*/
|
*/
|
||||||
private static LogFactory getCachedFactory(ClassLoader contextClassLoader)
|
private static LogFactory getCachedFactory(ClassLoader contextClassLoader)
|
||||||
{
|
{
|
||||||
@@ -567,10 +567,10 @@ public abstract class LogFactory {
|
|||||||
try {
|
try {
|
||||||
if (classLoader != null) {
|
if (classLoader != null) {
|
||||||
try {
|
try {
|
||||||
// first the given class loader param (thread class loader)
|
// First the given class loader param (thread class loader)
|
||||||
|
|
||||||
// warning: must typecast here & allow exception
|
// Warning: must typecast here & allow exception
|
||||||
// to be generated/caught & recast propertly.
|
// to be generated/caught & recast properly.
|
||||||
logFactoryClass = classLoader.loadClass(factoryClass);
|
logFactoryClass = classLoader.loadClass(factoryClass);
|
||||||
return (LogFactory) logFactoryClass.newInstance();
|
return (LogFactory) logFactoryClass.newInstance();
|
||||||
|
|
||||||
@@ -593,12 +593,12 @@ public abstract class LogFactory {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ignore exception, continue
|
// Ignore exception, continue
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this point, either classLoader == null, OR
|
/* At this point, either classLoader == null, OR
|
||||||
* classLoader was unable to load factoryClass..
|
* classLoader was unable to load factoryClass.
|
||||||
* try the class loader that loaded this class:
|
* Try the class loader that loaded this class:
|
||||||
* LogFactory.getClassLoader().
|
* LogFactory.getClassLoader().
|
||||||
*
|
*
|
||||||
* Notes:
|
* Notes:
|
||||||
@@ -607,12 +607,12 @@ public abstract class LogFactory {
|
|||||||
* b) The Java endorsed library mechanism is instead
|
* b) The Java endorsed library mechanism is instead
|
||||||
* Class.forName(factoryClass);
|
* Class.forName(factoryClass);
|
||||||
*/
|
*/
|
||||||
// warning: must typecast here & allow exception
|
// Warning: must typecast here & allow exception
|
||||||
// to be generated/caught & recast propertly.
|
// to be generated/caught & recast properly.
|
||||||
logFactoryClass = Class.forName(factoryClass);
|
logFactoryClass = Class.forName(factoryClass);
|
||||||
return (LogFactory) logFactoryClass.newInstance();
|
return (LogFactory) logFactoryClass.newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// check to see if we've got a bad configuration
|
// Check to see if we've got a bad configuration
|
||||||
if (logFactoryClass != null
|
if (logFactoryClass != null
|
||||||
&& !LogFactory.class.isAssignableFrom(logFactoryClass)) {
|
&& !LogFactory.class.isAssignableFrom(logFactoryClass)) {
|
||||||
return new LogConfigurationException(
|
return new LogConfigurationException(
|
||||||
|
|||||||
@@ -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.19 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/LogSource.java,v 1.20 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.19 $
|
* $Revision: 1.20 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -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.19 2003/10/09 21:37:47 rdonkin Exp $
|
* @version $Id: LogSource.java,v 1.20 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
*/
|
*/
|
||||||
public class LogSource {
|
public class LogSource {
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public class LogSource {
|
|||||||
/** Is log4j available (in the current classpath) */
|
/** Is log4j available (in the current classpath) */
|
||||||
static protected boolean log4jIsAvailable = false;
|
static protected boolean log4jIsAvailable = false;
|
||||||
|
|
||||||
/** Is JD 1.4 logging available */
|
/** Is JDK 1.4 logging available */
|
||||||
static protected boolean jdk14IsAvailable = false;
|
static protected boolean jdk14IsAvailable = false;
|
||||||
|
|
||||||
/** Constructor for current log class */
|
/** Constructor for current log class */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/AvalonLogger.java,v 1.6 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/AvalonLogger.java,v 1.7 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.6 $
|
* $Revision: 1.7 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -67,10 +67,10 @@ import org.apache.commons.logging.Log;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of commons-logging Log interface that delegates all
|
* Implementation of commons-logging Log interface that delegates all
|
||||||
* logging calls to Avalon logging abstraction: the Logger interface.
|
* logging calls to the Avalon logging abstraction: the Logger interface.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:neeme@apache.org">Neeme Praks</a>
|
* @author <a href="mailto:neeme@apache.org">Neeme Praks</a>
|
||||||
* @version $Revision: 1.6 $ $Date: 2003/10/09 21:37:47 $
|
* @version $Revision: 1.7 $ $Date: 2004/02/28 17:54:14 $
|
||||||
*/
|
*/
|
||||||
public class AvalonLogger implements Log, Serializable {
|
public class AvalonLogger implements Log, Serializable {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Jdk14Logger.java,v 1.10 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Jdk14Logger.java,v 1.11 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.10 $
|
* $Revision: 1.11 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -78,7 +78,7 @@ import org.apache.commons.logging.Log;
|
|||||||
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
|
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
|
||||||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
|
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
|
||||||
* @version $Revision: 1.10 $ $Date: 2003/10/09 21:37:47 $
|
* @version $Revision: 1.11 $ $Date: 2004/02/28 17:54:14 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Jdk14Logger implements Log, Serializable {
|
public class Jdk14Logger implements Log, Serializable {
|
||||||
@@ -249,7 +249,7 @@ public class Jdk14Logger implements Log, Serializable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is tace logging currently enabled?
|
* Is trace logging currently enabled?
|
||||||
*/
|
*/
|
||||||
public boolean isTraceEnabled() {
|
public boolean isTraceEnabled() {
|
||||||
return (getLogger().isLoggable(Level.FINEST));
|
return (getLogger().isLoggable(Level.FINEST));
|
||||||
@@ -257,7 +257,7 @@ public class Jdk14Logger implements Log, Serializable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is warning logging currently enabled?
|
* Is warn logging currently enabled?
|
||||||
*/
|
*/
|
||||||
public boolean isWarnEnabled() {
|
public boolean isWarnEnabled() {
|
||||||
return (getLogger().isLoggable(Level.WARNING));
|
return (getLogger().isLoggable(Level.WARNING));
|
||||||
|
|||||||
@@ -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.13 2003/10/09 21:37:47 rdonkin 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.14 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.13 $
|
* $Revision: 1.14 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -77,7 +77,7 @@ import org.apache.log4j.Priority;
|
|||||||
* @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.13 2003/10/09 21:37:47 rdonkin Exp $
|
* @version $Id: Log4JCategoryLog.java,v 1.14 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
*/
|
*/
|
||||||
public final class Log4JCategoryLog implements Log {
|
public final class Log4JCategoryLog implements Log {
|
||||||
|
|
||||||
@@ -98,13 +98,13 @@ public final class Log4JCategoryLog implements Log {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base constructor
|
* Base constructor.
|
||||||
*/
|
*/
|
||||||
public Log4JCategoryLog(String name) {
|
public Log4JCategoryLog(String name) {
|
||||||
this.category=Category.getInstance(name);
|
this.category=Category.getInstance(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For use with a log4j factory
|
/** For use with a log4j factory.
|
||||||
*/
|
*/
|
||||||
public Log4JCategoryLog(Category category ) {
|
public Log4JCategoryLog(Category category ) {
|
||||||
this.category=category;
|
this.category=category;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Log4JLogger.java,v 1.8 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Log4JLogger.java,v 1.9 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.8 $
|
* $Revision: 1.9 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -76,7 +76,7 @@ import org.apache.log4j.Priority;
|
|||||||
* @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: Log4JLogger.java,v 1.8 2003/10/09 21:37:47 rdonkin Exp $
|
* @version $Id: Log4JLogger.java,v 1.9 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
*/
|
*/
|
||||||
public class Log4JLogger implements Log, Serializable {
|
public class Log4JLogger implements Log, Serializable {
|
||||||
|
|
||||||
@@ -100,14 +100,14 @@ public class Log4JLogger implements Log, Serializable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base constructor
|
* Base constructor.
|
||||||
*/
|
*/
|
||||||
public Log4JLogger(String name) {
|
public Log4JLogger(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.logger = getLogger();
|
this.logger = getLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For use with a log4j factory
|
/** For use with a log4j factory.
|
||||||
*/
|
*/
|
||||||
public Log4JLogger(Logger logger ) {
|
public Log4JLogger(Logger logger ) {
|
||||||
this.name = logger.getName();
|
this.name = logger.getName();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Log4jFactory.java,v 1.7 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Log4jFactory.java,v 1.8 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.7 $
|
* $Revision: 1.8 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -92,7 +92,7 @@ public final class Log4jFactory extends LogFactory {
|
|||||||
*/
|
*/
|
||||||
private Hashtable attributes = new Hashtable();
|
private Hashtable attributes = new Hashtable();
|
||||||
|
|
||||||
// previously returned instances, to avoid creation of proxies
|
// Previously returned instances, to avoid creation of proxies
|
||||||
private Hashtable instances = new Hashtable();
|
private Hashtable instances = new Hashtable();
|
||||||
|
|
||||||
// --------------------------------------------------------- Public Methods
|
// --------------------------------------------------------- Public Methods
|
||||||
@@ -164,7 +164,7 @@ public final class Log4jFactory extends LogFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Release any internal references to previously created {@link Log}
|
* Release any internal references to previously created {@link Log}
|
||||||
* instances returned by this factory. This is useful environments
|
* instances returned by this factory. This is useful in environments
|
||||||
* like servlet containers, which implement application reloading by
|
* like servlet containers, which implement application reloading by
|
||||||
* throwing away a ClassLoader. Dangling references to objects in that
|
* throwing away a ClassLoader. Dangling references to objects in that
|
||||||
* class loader would prevent garbage collection.
|
* class loader would prevent garbage collection.
|
||||||
|
|||||||
@@ -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.28 2003/10/09 21:37:47 rdonkin 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.29 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.28 $
|
* $Revision: 1.29 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -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.28 $ $Date: 2003/10/09 21:37:47 $
|
* @version $Revision: 1.29 $ $Date: 2004/02/28 17:54:14 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class LogFactoryImpl extends LogFactory {
|
public class LogFactoryImpl extends LogFactory {
|
||||||
@@ -146,7 +146,7 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration attributes
|
* Configuration attributes.
|
||||||
*/
|
*/
|
||||||
protected Hashtable attributes = new Hashtable();
|
protected Hashtable attributes = new Hashtable();
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
/**
|
/**
|
||||||
* Release any internal references to previously created
|
* Release any internal references to previously created
|
||||||
* {@link org.apache.commons.logging.Log}
|
* {@link org.apache.commons.logging.Log}
|
||||||
* instances returned by this factory. This is useful environments
|
* instances returned by this factory. This is useful in environments
|
||||||
* like servlet containers, which implement application reloading by
|
* like servlet containers, which implement application reloading by
|
||||||
* throwing away a ClassLoader. Dangling references to objects in that
|
* throwing away a ClassLoader. Dangling references to objects in that
|
||||||
* class loader would prevent garbage collection.
|
* class loader would prevent garbage collection.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/SimpleLog.java,v 1.14 2003/10/09 21:37:47 rdonkin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/SimpleLog.java,v 1.15 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
* $Revision: 1.14 $
|
* $Revision: 1.15 $
|
||||||
* $Date: 2003/10/09 21:37:47 $
|
* $Date: 2004/02/28 17:54:14 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -93,7 +93,7 @@ import org.apache.commons.logging.LogConfigurationException;
|
|||||||
* Set to <code>true</code> if you want the Log instance name to be
|
* Set to <code>true</code> if you want the Log instance name to be
|
||||||
* included in output messages. Defaults to <code>false</code>.</li>
|
* included in output messages. Defaults to <code>false</code>.</li>
|
||||||
* <li><code>org.apache.commons.logging.simplelog.showShortLogname</code> -
|
* <li><code>org.apache.commons.logging.simplelog.showShortLogname</code> -
|
||||||
* Set to <code>true</code> if you want the last componet of the name to be
|
* Set to <code>true</code> if you want the last component of the name to be
|
||||||
* included in output messages. Defaults to <code>true</code>.</li>
|
* included in output messages. Defaults to <code>true</code>.</li>
|
||||||
* <li><code>org.apache.commons.logging.simplelog.showdatetime</code> -
|
* <li><code>org.apache.commons.logging.simplelog.showdatetime</code> -
|
||||||
* Set to <code>true</code> if you want the current date and time
|
* Set to <code>true</code> if you want the current date and time
|
||||||
@@ -109,7 +109,7 @@ import org.apache.commons.logging.LogConfigurationException;
|
|||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @author Robert Burrell Donkin
|
* @author Robert Burrell Donkin
|
||||||
*
|
*
|
||||||
* @version $Id: SimpleLog.java,v 1.14 2003/10/09 21:37:47 rdonkin Exp $
|
* @version $Id: SimpleLog.java,v 1.15 2004/02/28 17:54:14 rdonkin Exp $
|
||||||
*/
|
*/
|
||||||
public class SimpleLog implements Log, Serializable {
|
public class SimpleLog implements Log, Serializable {
|
||||||
|
|
||||||
@@ -179,11 +179,11 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
return (prop == null) ? dephault : "true".equalsIgnoreCase(prop);
|
return (prop == null) ? dephault : "true".equalsIgnoreCase(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize class attributes
|
// Initialize class attributes.
|
||||||
// load properties file, if found.
|
// Load properties file, if found.
|
||||||
// override with system properties.
|
// Override with system properties.
|
||||||
static {
|
static {
|
||||||
// add props from the resource simplelog.properties
|
// Add props from the resource simplelog.properties
|
||||||
InputStream in = getResourceAsStream("simplelog.properties");
|
InputStream in = getResourceAsStream("simplelog.properties");
|
||||||
if(null != in) {
|
if(null != in) {
|
||||||
try {
|
try {
|
||||||
@@ -228,12 +228,12 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
|
|
||||||
logName = name;
|
logName = name;
|
||||||
|
|
||||||
// set initial log level
|
// Set initial log level
|
||||||
// Used to be: set default log level to ERROR
|
// Used to be: set default log level to ERROR
|
||||||
// IMHO it should be lower, but at least info ( costin ).
|
// IMHO it should be lower, but at least info ( costin ).
|
||||||
setLevel(SimpleLog.LOG_LEVEL_INFO);
|
setLevel(SimpleLog.LOG_LEVEL_INFO);
|
||||||
|
|
||||||
// set log level from properties
|
// Set log level from properties
|
||||||
String lvl = getStringProperty(systemPrefix + "log." + logName);
|
String lvl = getStringProperty(systemPrefix + "log." + logName);
|
||||||
int i = String.valueOf(name).lastIndexOf(".");
|
int i = String.valueOf(name).lastIndexOf(".");
|
||||||
while(null == lvl && i > -1) {
|
while(null == lvl && i > -1) {
|
||||||
@@ -299,16 +299,16 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
* and then prints to <code>System.err</code>.</p>
|
* and then prints to <code>System.err</code>.</p>
|
||||||
*/
|
*/
|
||||||
protected void log(int type, Object message, Throwable t) {
|
protected void log(int type, Object message, Throwable t) {
|
||||||
// use a string buffer for better performance
|
// Use a string buffer for better performance
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
|
||||||
// append date-time if so configured
|
// Append date-time if so configured
|
||||||
if(showDateTime) {
|
if(showDateTime) {
|
||||||
buf.append(dateFormatter.format(new Date()));
|
buf.append(dateFormatter.format(new Date()));
|
||||||
buf.append(" ");
|
buf.append(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// append a readable representation of the log leve
|
// Append a readable representation of the log level
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SimpleLog.LOG_LEVEL_TRACE: buf.append("[TRACE] "); break;
|
case SimpleLog.LOG_LEVEL_TRACE: buf.append("[TRACE] "); break;
|
||||||
case SimpleLog.LOG_LEVEL_DEBUG: buf.append("[DEBUG] "); break;
|
case SimpleLog.LOG_LEVEL_DEBUG: buf.append("[DEBUG] "); break;
|
||||||
@@ -318,7 +318,7 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
case SimpleLog.LOG_LEVEL_FATAL: buf.append("[FATAL] "); break;
|
case SimpleLog.LOG_LEVEL_FATAL: buf.append("[FATAL] "); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// append the name of the log instance if so configured
|
// Append the name of the log instance if so configured
|
||||||
if( showShortName) {
|
if( showShortName) {
|
||||||
if( prefix==null ) {
|
if( prefix==null ) {
|
||||||
// cut all but the last component of the name for both styles
|
// cut all but the last component of the name for both styles
|
||||||
@@ -330,10 +330,10 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
buf.append(String.valueOf(logName)).append(" - ");
|
buf.append(String.valueOf(logName)).append(" - ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// append the message
|
// Append the message
|
||||||
buf.append(String.valueOf(message));
|
buf.append(String.valueOf(message));
|
||||||
|
|
||||||
// append stack trace if not null
|
// Append stack trace if not null
|
||||||
if(t != null) {
|
if(t != null) {
|
||||||
buf.append(" <");
|
buf.append(" <");
|
||||||
buf.append(t.toString());
|
buf.append(t.toString());
|
||||||
@@ -346,7 +346,7 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
buf.append(sw.toString());
|
buf.append(sw.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// print to System.err
|
// Print to System.err
|
||||||
System.err.println(buf.toString());
|
System.err.println(buf.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Log a message with debug log level.</p>
|
* <p> Log a message with trace log level.</p>
|
||||||
*/
|
*/
|
||||||
public final void trace(Object message) {
|
public final void trace(Object message) {
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Log an error with debug log level.</p>
|
* <p> Log an error with trace log level.</p>
|
||||||
*/
|
*/
|
||||||
public final void trace(Object message, Throwable t) {
|
public final void trace(Object message, Throwable t) {
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ prebuilt support for the following:</p>
|
|||||||
Avalon project. Each named <a href="Log.html">Log</a> instance is
|
Avalon project. Each named <a href="Log.html">Log</a> instance is
|
||||||
connected to a corresponding LogKit <code>Logger</code>.</li>
|
connected to a corresponding LogKit <code>Logger</code>.</li>
|
||||||
<li><a href="impl/NoOpLog.html">NoOpLog</a> implementation that simply swallows
|
<li><a href="impl/NoOpLog.html">NoOpLog</a> implementation that simply swallows
|
||||||
all log output, for all named <a href="Log.html">Log</a> isntances.</li>
|
all log output, for all named <a href="Log.html">Log</a> instances.</li>
|
||||||
<li><a href="impl/SimpleLog.html">SimpleLog</a> implementation that writes all
|
<li><a href="impl/SimpleLog.html">SimpleLog</a> implementation that writes all
|
||||||
log output, for all named <a href="Log.html">Log</a> instances, to
|
log output, for all named <a href="Log.html">Log</a> instances, to
|
||||||
System.err.</li>
|
System.err.</li>
|
||||||
@@ -63,7 +63,7 @@ application.</p>
|
|||||||
<h3>Configuring the Commons Logging Package</h3>
|
<h3>Configuring the Commons Logging Package</h3>
|
||||||
|
|
||||||
|
|
||||||
<h4>Choosing A <code>LogFactory</code> Implementation</h4>
|
<h4>Choosing a <code>LogFactory</code> Implementation</h4>
|
||||||
|
|
||||||
<p>From an application perspective, the first requirement is to retrieve an
|
<p>From an application perspective, the first requirement is to retrieve an
|
||||||
object reference to the <code>LogFactory</code> instance that will be used
|
object reference to the <code>LogFactory</code> instance that will be used
|
||||||
@@ -135,7 +135,7 @@ implementation uses the following rules:</p>
|
|||||||
<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>
|
||||||
<li>Fall back to the default simple logging wrapper
|
<li>Fall back to the default simple logging implementation
|
||||||
(<a href="impl/SimpleLog.html">SimpleLog</a>).</li>
|
(<a href="impl/SimpleLog.html">SimpleLog</a>).</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li>Load the class of the specified name from the thread context class
|
<li>Load the class of the specified name from the thread context class
|
||||||
@@ -187,11 +187,11 @@ component, consists of the following steps:</p>
|
|||||||
<p>For convenience, <code>LogFactory</code> also offers a static method
|
<p>For convenience, <code>LogFactory</code> also offers a static method
|
||||||
<code>getLog()</code> that combines the typical two-step pattern:</p>
|
<code>getLog()</code> that combines the typical two-step pattern:</p>
|
||||||
<pre>
|
<pre>
|
||||||
Log log = LogFactory.getFactory().getInstance("Foo");
|
Log log = LogFactory.getFactory().getInstance(Foo.class);
|
||||||
</pre>
|
</pre>
|
||||||
<p>into a single method call:</p>
|
<p>into a single method call:</p>
|
||||||
<pre>
|
<pre>
|
||||||
Log log = LogFactory.getLog("Foo");
|
Log log = LogFactory.getLog(Foo.class);
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>For example, you might use the following technique to initialize and
|
<p>For example, you might use the following technique to initialize and
|
||||||
@@ -203,7 +203,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
public class MyComponent {
|
public class MyComponent {
|
||||||
|
|
||||||
protected static Log log =
|
protected static Log log =
|
||||||
LogFactory.getLog("my.component");
|
LogFactory.getLog(MyComponent.class);
|
||||||
|
|
||||||
// Called once at startup time
|
// Called once at startup time
|
||||||
public void start() {
|
public void start() {
|
||||||
|
|||||||
Reference in New Issue
Block a user