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 $
|
||||
* $Revision: 1.16 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.17 $
|
||||
* $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 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 {
|
||||
|
||||
@@ -114,7 +114,7 @@ public interface Log {
|
||||
* <p> Is debug logging currently enabled? </p>
|
||||
*
|
||||
* <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>
|
||||
*/
|
||||
public boolean isDebugEnabled();
|
||||
@@ -124,7 +124,7 @@ public interface Log {
|
||||
* <p> Is error logging currently enabled? </p>
|
||||
*
|
||||
* <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>
|
||||
*/
|
||||
public boolean isErrorEnabled();
|
||||
@@ -134,7 +134,7 @@ public interface Log {
|
||||
* <p> Is fatal logging currently enabled? </p>
|
||||
*
|
||||
* <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>
|
||||
*/
|
||||
public boolean isFatalEnabled();
|
||||
@@ -144,7 +144,7 @@ public interface Log {
|
||||
* <p> Is info logging currently enabled? </p>
|
||||
*
|
||||
* <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>
|
||||
*/
|
||||
public boolean isInfoEnabled();
|
||||
@@ -154,7 +154,7 @@ public interface Log {
|
||||
* <p> Is trace logging currently enabled? </p>
|
||||
*
|
||||
* <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>
|
||||
*/
|
||||
public boolean isTraceEnabled();
|
||||
@@ -164,8 +164,8 @@ public interface Log {
|
||||
* <p> Is warning logging currently enabled? </p>
|
||||
*
|
||||
* <p> Call this method to prevent having to perform expensive operations
|
||||
* (for example, <code>String</code> concatination)
|
||||
* when the log level is more than warning. </p>
|
||||
* (for example, <code>String</code> concatenation)
|
||||
* when the log level is more than warn. </p>
|
||||
*/
|
||||
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 $
|
||||
* $Revision: 1.24 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.25 $
|
||||
* $Date: 2004/02/28 17:54:14 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
@@ -79,7 +79,7 @@ import java.util.Properties;
|
||||
* <p>Factory for creating {@link Log} instances, with discovery and
|
||||
* configuration features similar to that employed by standard Java APIs
|
||||
* such as JAXP.</p>
|
||||
*
|
||||
*
|
||||
* <p><strong>IMPLEMENTATION NOTE</strong> - This implementation is heavily
|
||||
* based on the SAXParserFactory and DocumentBuilderFactory implementations
|
||||
* (corresponding to the JAXP pluggability APIs) found in Apache Xerces.</p>
|
||||
@@ -87,7 +87,7 @@ import java.util.Properties;
|
||||
* @author Craig R. McClanahan
|
||||
* @author Costin Manolache
|
||||
* @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 {
|
||||
@@ -117,7 +117,7 @@ public abstract class LogFactory {
|
||||
"commons-logging.properties";
|
||||
|
||||
/**
|
||||
* JDK1.3+ 'Service Provider' specification
|
||||
* JDK1.3+ 'Service Provider' specification
|
||||
* ( http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html )
|
||||
*/
|
||||
protected static final String SERVICE_ID =
|
||||
@@ -189,7 +189,7 @@ public abstract class LogFactory {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* throwing away a ClassLoader. Dangling references to objects in that
|
||||
* class loader would prevent garbage collection.
|
||||
@@ -273,8 +273,8 @@ public abstract class LogFactory {
|
||||
return factory;
|
||||
|
||||
|
||||
// Load properties file..
|
||||
// will be used one way or another in the end.
|
||||
// Load properties file.
|
||||
// Will be used one way or another in the end.
|
||||
|
||||
Properties props=null;
|
||||
try {
|
||||
@@ -290,7 +290,7 @@ public abstract class LogFactory {
|
||||
} catch (SecurityException e) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// First, try the system property
|
||||
try {
|
||||
String factoryClass = System.getProperty(FACTORY_PROPERTY);
|
||||
@@ -305,7 +305,7 @@ public abstract class LogFactory {
|
||||
// Second, try to find a service by using the JDK1.3 jar
|
||||
// discovery mechanism. This will allow users to plug a logger
|
||||
// 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.
|
||||
|
||||
if (factory == null) {
|
||||
@@ -322,13 +322,13 @@ public abstract class LogFactory {
|
||||
} catch (java.io.UnsupportedEncodingException e) {
|
||||
rd = new BufferedReader(new InputStreamReader(is));
|
||||
}
|
||||
|
||||
|
||||
String factoryClassName = rd.readLine();
|
||||
rd.close();
|
||||
|
||||
|
||||
if (factoryClassName != null &&
|
||||
! "".equals(factoryClassName)) {
|
||||
|
||||
|
||||
factory= newFactory( factoryClassName, contextClassLoader );
|
||||
}
|
||||
}
|
||||
@@ -338,7 +338,7 @@ public abstract class LogFactory {
|
||||
}
|
||||
|
||||
|
||||
// Third try a properties file.
|
||||
// Third try a properties file.
|
||||
// If the properties file exists, it'll be read and the properties
|
||||
// used. IMHO ( costin ) System property and JDK1.3 jar service
|
||||
// should be enough for detecting the class name. The properties
|
||||
@@ -359,10 +359,10 @@ public abstract class LogFactory {
|
||||
if (factory == null) {
|
||||
factory = newFactory(FACTORY_DEFAULT, LogFactory.class.getClassLoader());
|
||||
}
|
||||
|
||||
|
||||
if (factory != null) {
|
||||
/**
|
||||
* Always cache using context class loader..
|
||||
* Always cache using context class loader.
|
||||
*/
|
||||
cacheFactory(contextClassLoader, factory);
|
||||
|
||||
@@ -375,7 +375,7 @@ public abstract class LogFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ public abstract class LogFactory {
|
||||
* Convenience method to return a named logger, without the application
|
||||
* 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>
|
||||
* instance cannot be returned
|
||||
@@ -440,7 +440,7 @@ public abstract class LogFactory {
|
||||
/**
|
||||
* Release any internal references to previously created {@link LogFactory}
|
||||
* 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.
|
||||
* Dangling references to objects in that class loader would prevent
|
||||
* garbage collection.
|
||||
@@ -465,7 +465,7 @@ public abstract class LogFactory {
|
||||
/**
|
||||
* Return the thread context class loader if available.
|
||||
* Otherwise return null.
|
||||
*
|
||||
*
|
||||
* The thread context class loader is available for JDK 1.2
|
||||
* or later, if certain security conditions are met.
|
||||
*
|
||||
@@ -492,12 +492,12 @@ public abstract class LogFactory {
|
||||
* InvocationTargetException is thrown by 'invoke' when
|
||||
* the method being invoked (getContextClassLoader) throws
|
||||
* an exception.
|
||||
*
|
||||
*
|
||||
* getContextClassLoader() throws SecurityException when
|
||||
* the context class loader isn't an ancestor of the
|
||||
* calling class's class loader, or if security
|
||||
* permissions are restricted.
|
||||
*
|
||||
*
|
||||
* In the first case (not related), we want to ignore and
|
||||
* keep going. We cannot help but also ignore the second
|
||||
* with the logic below, but other calls elsewhere (to
|
||||
@@ -523,18 +523,18 @@ public abstract class LogFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check cached factories (keyed by classLoader)
|
||||
* Check cached factories (keyed by contextClassLoader)
|
||||
*/
|
||||
private static LogFactory getCachedFactory(ClassLoader contextClassLoader)
|
||||
{
|
||||
LogFactory factory = null;
|
||||
|
||||
|
||||
if (contextClassLoader != null)
|
||||
factory = (LogFactory) factories.get(contextClassLoader);
|
||||
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
private static void cacheFactory(ClassLoader classLoader, LogFactory factory)
|
||||
{
|
||||
if (classLoader != null && factory != null)
|
||||
@@ -562,18 +562,18 @@ public abstract class LogFactory {
|
||||
new PrivilegedAction() {
|
||||
public Object run() {
|
||||
// This will be used to diagnose bad configurations
|
||||
// and allow a useful message to be sent to the user
|
||||
// and allow a useful message to be sent to the user
|
||||
Class logFactoryClass = null;
|
||||
try {
|
||||
if (classLoader != null) {
|
||||
try {
|
||||
// first the given class loader param (thread class loader)
|
||||
|
||||
// warning: must typecast here & allow exception
|
||||
// to be generated/caught & recast propertly.
|
||||
// First the given class loader param (thread class loader)
|
||||
|
||||
// Warning: must typecast here & allow exception
|
||||
// to be generated/caught & recast properly.
|
||||
logFactoryClass = classLoader.loadClass(factoryClass);
|
||||
return (LogFactory) logFactoryClass.newInstance();
|
||||
|
||||
|
||||
} catch (ClassNotFoundException ex) {
|
||||
if (classLoader == LogFactory.class.getClassLoader()) {
|
||||
// Nothing more to try, onwards.
|
||||
@@ -585,39 +585,39 @@ public abstract class LogFactory {
|
||||
// Nothing more to try, onwards.
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
} catch(ClassCastException e){
|
||||
|
||||
|
||||
if (classLoader == LogFactory.class.getClassLoader()) {
|
||||
// Nothing more to try, onwards (bug in loader implementation).
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
// ignore exception, continue
|
||||
// Ignore exception, continue
|
||||
}
|
||||
|
||||
|
||||
/* At this point, either classLoader == null, OR
|
||||
* classLoader was unable to load factoryClass..
|
||||
* try the class loader that loaded this class:
|
||||
* classLoader was unable to load factoryClass.
|
||||
* Try the class loader that loaded this class:
|
||||
* LogFactory.getClassLoader().
|
||||
*
|
||||
*
|
||||
* Notes:
|
||||
* a) LogFactory.class.getClassLoader() may return 'null'
|
||||
* if LogFactory is loaded by the bootstrap classloader.
|
||||
* b) The Java endorsed library mechanism is instead
|
||||
* Class.forName(factoryClass);
|
||||
*/
|
||||
// warning: must typecast here & allow exception
|
||||
// to be generated/caught & recast propertly.
|
||||
// Warning: must typecast here & allow exception
|
||||
// to be generated/caught & recast properly.
|
||||
logFactoryClass = Class.forName(factoryClass);
|
||||
return (LogFactory) logFactoryClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
// check to see if we've got a bad configuration
|
||||
if (logFactoryClass != null
|
||||
// Check to see if we've got a bad configuration
|
||||
if (logFactoryClass != null
|
||||
&& !LogFactory.class.isAssignableFrom(logFactoryClass)) {
|
||||
return new LogConfigurationException(
|
||||
"The chosen LogFactory implementation does not extend LogFactory."
|
||||
+ " Please check your configuration.",
|
||||
+ " Please check your configuration.",
|
||||
e);
|
||||
}
|
||||
return new LogConfigurationException(e);
|
||||
@@ -627,10 +627,10 @@ public abstract class LogFactory {
|
||||
|
||||
if (result instanceof LogConfigurationException)
|
||||
throw (LogConfigurationException)result;
|
||||
|
||||
|
||||
return (LogFactory)result;
|
||||
}
|
||||
|
||||
|
||||
private static InputStream getResourceAsStream(final ClassLoader loader,
|
||||
final String name)
|
||||
{
|
||||
|
||||
@@ -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 $
|
||||
* $Revision: 1.19 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.20 $
|
||||
* $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
|
||||
*
|
||||
* @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 {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class LogSource {
|
||||
/** Is log4j available (in the current classpath) */
|
||||
static protected boolean log4jIsAvailable = false;
|
||||
|
||||
/** Is JD 1.4 logging available */
|
||||
/** Is JDK 1.4 logging available */
|
||||
static protected boolean jdk14IsAvailable = false;
|
||||
|
||||
/** 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 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.7 $
|
||||
* $Date: 2004/02/28 17:54:14 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
@@ -66,11 +66,11 @@ import org.apache.avalon.framework.logger.Logger;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
/**
|
||||
* Implementation of commons-logging Log interface that delegates all
|
||||
* logging calls to Avalon logging abstraction: the Logger interface.
|
||||
*
|
||||
* Implementation of commons-logging Log interface that delegates all
|
||||
* logging calls to the Avalon logging abstraction: the Logger interface.
|
||||
*
|
||||
* @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 {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AvalonLogger implements Log, Serializable {
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
* @param logger the avalon logger implementation to delegate to
|
||||
* @param logger the avalon logger implementation to delegate to
|
||||
*/
|
||||
public AvalonLogger(Logger logger) {
|
||||
this.name = name;
|
||||
@@ -87,10 +87,10 @@ public class AvalonLogger implements Log, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name of the avalon logger implementation to delegate to
|
||||
* @param name the name of the avalon logger implementation to delegate to
|
||||
*/
|
||||
public AvalonLogger(String name) {
|
||||
if (defaultLogger == null)
|
||||
if (defaultLogger == null)
|
||||
throw new NullPointerException("default logger has to be specified if this constructor is used!");
|
||||
this.logger = getLogger();
|
||||
}
|
||||
|
||||
@@ -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 $
|
||||
* $Revision: 1.10 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.11 $
|
||||
* $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:bloritsch@apache.org">Berin Loritsch</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 {
|
||||
@@ -249,7 +249,7 @@ public class Jdk14Logger implements Log, Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Is tace logging currently enabled?
|
||||
* Is trace logging currently enabled?
|
||||
*/
|
||||
public boolean isTraceEnabled() {
|
||||
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() {
|
||||
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 $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.14 $
|
||||
* $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 Rod Waldhoff
|
||||
* @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 {
|
||||
|
||||
@@ -86,7 +86,7 @@ public final class Log4JCategoryLog implements Log {
|
||||
|
||||
/** The fully qualified name of the Log4JCategoryLog class. */
|
||||
private static final String FQCN = Log4JCategoryLog.class.getName();
|
||||
|
||||
|
||||
/** Log to this category */
|
||||
private Category category = null;
|
||||
|
||||
@@ -98,13 +98,13 @@ public final class Log4JCategoryLog implements Log {
|
||||
|
||||
|
||||
/**
|
||||
* Base constructor
|
||||
* Base constructor.
|
||||
*/
|
||||
public Log4JCategoryLog(String name) {
|
||||
this.category=Category.getInstance(name);
|
||||
}
|
||||
|
||||
/** For use with a log4j factory
|
||||
/** For use with a log4j factory.
|
||||
*/
|
||||
public Log4JCategoryLog(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 $
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.9 $
|
||||
* $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 Rod Waldhoff
|
||||
* @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 {
|
||||
|
||||
@@ -85,7 +85,7 @@ public class Log4JLogger implements Log, Serializable {
|
||||
|
||||
/** The fully qualified name of the Log4JLogger class. */
|
||||
private static final String FQCN = Log4JLogger.class.getName();
|
||||
|
||||
|
||||
/** Log to this logger */
|
||||
private transient Logger logger = null;
|
||||
|
||||
@@ -100,14 +100,14 @@ public class Log4JLogger implements Log, Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Base constructor
|
||||
* Base constructor.
|
||||
*/
|
||||
public Log4JLogger(String name) {
|
||||
this.name = name;
|
||||
this.logger = getLogger();
|
||||
}
|
||||
|
||||
/** For use with a log4j factory
|
||||
/** For use with a log4j factory.
|
||||
*/
|
||||
public Log4JLogger(Logger logger ) {
|
||||
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 $
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.8 $
|
||||
* $Date: 2004/02/28 17:54:14 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
@@ -92,7 +92,7 @@ public final class Log4jFactory extends LogFactory {
|
||||
*/
|
||||
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();
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
@@ -164,7 +164,7 @@ public final class Log4jFactory extends LogFactory {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* throwing away a ClassLoader. Dangling references to objects in that
|
||||
* class loader would prevent garbage collection.
|
||||
@@ -173,7 +173,7 @@ public final class Log4jFactory extends LogFactory {
|
||||
|
||||
instances.clear();
|
||||
|
||||
// what's the log4j mechanism to cleanup ???
|
||||
// what's the log4j mechanism to cleanup ???
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 $
|
||||
* $Revision: 1.28 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.29 $
|
||||
* $Date: 2004/02/28 17:54:14 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
@@ -107,7 +107,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* @author Rod Waldhoff
|
||||
* @author Craig R. McClanahan
|
||||
* @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 {
|
||||
@@ -146,7 +146,7 @@ public class LogFactoryImpl extends LogFactory {
|
||||
|
||||
|
||||
/**
|
||||
* Configuration attributes
|
||||
* Configuration attributes.
|
||||
*/
|
||||
protected Hashtable attributes = new Hashtable();
|
||||
|
||||
@@ -280,7 +280,7 @@ public class LogFactoryImpl extends LogFactory {
|
||||
/**
|
||||
* Release any internal references to previously created
|
||||
* {@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
|
||||
* throwing away a ClassLoader. Dangling references to objects in that
|
||||
* 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 $
|
||||
* $Revision: 1.14 $
|
||||
* $Date: 2003/10/09 21:37:47 $
|
||||
* $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.15 $
|
||||
* $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
|
||||
* included in output messages. Defaults to <code>false</code>.</li>
|
||||
* <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>
|
||||
* <li><code>org.apache.commons.logging.simplelog.showdatetime</code> -
|
||||
* 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 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 {
|
||||
|
||||
@@ -158,7 +158,7 @@ public class SimpleLog implements Log, Serializable {
|
||||
public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1);
|
||||
|
||||
// ------------------------------------------------------------ Initializer
|
||||
|
||||
|
||||
private static String getStringProperty(String name) {
|
||||
String prop = null;
|
||||
try {
|
||||
@@ -179,11 +179,11 @@ public class SimpleLog implements Log, Serializable {
|
||||
return (prop == null) ? dephault : "true".equalsIgnoreCase(prop);
|
||||
}
|
||||
|
||||
// initialize class attributes
|
||||
// load properties file, if found.
|
||||
// override with system properties.
|
||||
// Initialize class attributes.
|
||||
// Load properties file, if found.
|
||||
// Override with system properties.
|
||||
static {
|
||||
// add props from the resource simplelog.properties
|
||||
// Add props from the resource simplelog.properties
|
||||
InputStream in = getResourceAsStream("simplelog.properties");
|
||||
if(null != in) {
|
||||
try {
|
||||
@@ -228,12 +228,12 @@ public class SimpleLog implements Log, Serializable {
|
||||
|
||||
logName = name;
|
||||
|
||||
// set initial log level
|
||||
// Set initial log level
|
||||
// Used to be: set default log level to ERROR
|
||||
// IMHO it should be lower, but at least info ( costin ).
|
||||
setLevel(SimpleLog.LOG_LEVEL_INFO);
|
||||
|
||||
// set log level from properties
|
||||
// Set log level from properties
|
||||
String lvl = getStringProperty(systemPrefix + "log." + logName);
|
||||
int i = String.valueOf(name).lastIndexOf(".");
|
||||
while(null == lvl && i > -1) {
|
||||
@@ -299,16 +299,16 @@ public class SimpleLog implements Log, Serializable {
|
||||
* and then prints to <code>System.err</code>.</p>
|
||||
*/
|
||||
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();
|
||||
|
||||
// append date-time if so configured
|
||||
// Append date-time if so configured
|
||||
if(showDateTime) {
|
||||
buf.append(dateFormatter.format(new Date()));
|
||||
buf.append(" ");
|
||||
}
|
||||
|
||||
// append a readable representation of the log leve
|
||||
// Append a readable representation of the log level
|
||||
switch(type) {
|
||||
case SimpleLog.LOG_LEVEL_TRACE: buf.append("[TRACE] "); 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;
|
||||
}
|
||||
|
||||
// append the name of the log instance if so configured
|
||||
// Append the name of the log instance if so configured
|
||||
if( showShortName) {
|
||||
if( prefix==null ) {
|
||||
// cut all but the last component of the name for both styles
|
||||
@@ -330,23 +330,23 @@ public class SimpleLog implements Log, Serializable {
|
||||
buf.append(String.valueOf(logName)).append(" - ");
|
||||
}
|
||||
|
||||
// append the message
|
||||
// Append the message
|
||||
buf.append(String.valueOf(message));
|
||||
|
||||
// append stack trace if not null
|
||||
// Append stack trace if not null
|
||||
if(t != null) {
|
||||
buf.append(" <");
|
||||
buf.append(t.toString());
|
||||
buf.append(">");
|
||||
|
||||
java.io.StringWriter sw= new java.io.StringWriter(1024);
|
||||
java.io.PrintWriter pw= new java.io.PrintWriter(sw);
|
||||
java.io.StringWriter sw= new java.io.StringWriter(1024);
|
||||
java.io.PrintWriter pw= new java.io.PrintWriter(sw);
|
||||
t.printStackTrace(pw);
|
||||
pw.close();
|
||||
buf.append(sw.toString());
|
||||
}
|
||||
|
||||
// print to System.err
|
||||
// Print to System.err
|
||||
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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -579,7 +579,7 @@ public class SimpleLog implements Log, Serializable {
|
||||
/**
|
||||
* Return the thread context class loader if available.
|
||||
* Otherwise return null.
|
||||
*
|
||||
*
|
||||
* The thread context class loader is available for JDK 1.2
|
||||
* or later, if certain security conditions are met.
|
||||
*
|
||||
@@ -594,7 +594,7 @@ public class SimpleLog implements Log, Serializable {
|
||||
try {
|
||||
// Are we running on a JDK 1.2 or later system?
|
||||
Method method = Thread.class.getMethod("getContextClassLoader", null);
|
||||
|
||||
|
||||
// Get the thread context class loader (if there is one)
|
||||
try {
|
||||
classLoader = (ClassLoader)method.invoke(Thread.currentThread(), null);
|
||||
@@ -605,12 +605,12 @@ public class SimpleLog implements Log, Serializable {
|
||||
* InvocationTargetException is thrown by 'invoke' when
|
||||
* the method being invoked (getContextClassLoader) throws
|
||||
* an exception.
|
||||
*
|
||||
*
|
||||
* getContextClassLoader() throws SecurityException when
|
||||
* the context class loader isn't an ancestor of the
|
||||
* calling class's class loader, or if security
|
||||
* permissions are restricted.
|
||||
*
|
||||
*
|
||||
* In the first case (not related), we want to ignore and
|
||||
* keep going. We cannot help but also ignore the second
|
||||
* with the logic below, but other calls elsewhere (to
|
||||
@@ -631,7 +631,7 @@ public class SimpleLog implements Log, Serializable {
|
||||
; // ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (classLoader == null) {
|
||||
classLoader = SimpleLog.class.getClassLoader();
|
||||
}
|
||||
@@ -639,7 +639,7 @@ public class SimpleLog implements Log, Serializable {
|
||||
// Return the selected class loader
|
||||
return classLoader;
|
||||
}
|
||||
|
||||
|
||||
private static InputStream getResourceAsStream(final String name)
|
||||
{
|
||||
return (InputStream)AccessController.doPrivileged(
|
||||
|
||||
@@ -19,7 +19,7 @@ prebuilt support for the following:</p>
|
||||
Avalon project. Each named <a href="Log.html">Log</a> instance is
|
||||
connected to a corresponding LogKit <code>Logger</code>.</li>
|
||||
<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
|
||||
log output, for all named <a href="Log.html">Log</a> instances, to
|
||||
System.err.</li>
|
||||
@@ -63,7 +63,7 @@ application.</p>
|
||||
<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
|
||||
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
|
||||
the corresponding wrapper class
|
||||
(<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>
|
||||
</ul></li>
|
||||
<li>Load the class of the specified name from the thread context class
|
||||
@@ -152,8 +152,8 @@ configuration information for this default implementation.</p>
|
||||
|
||||
<h4>Configuring the Underlying Logging System</h4>
|
||||
|
||||
<p>The basic principle is that the user is totally responsible for the
|
||||
configuration of the underlying logging system.
|
||||
<p>The basic principle is that the user is totally responsible for the
|
||||
configuration of the underlying logging system.
|
||||
Commons-logging should not change the existing configuration.</p>
|
||||
|
||||
<p>Each individual <a href="Log.html">Log</a> implementation may
|
||||
@@ -187,11 +187,11 @@ component, consists of the following steps:</p>
|
||||
<p>For convenience, <code>LogFactory</code> also offers a static method
|
||||
<code>getLog()</code> that combines the typical two-step pattern:</p>
|
||||
<pre>
|
||||
Log log = LogFactory.getFactory().getInstance("Foo");
|
||||
Log log = LogFactory.getFactory().getInstance(Foo.class);
|
||||
</pre>
|
||||
<p>into a single method call:</p>
|
||||
<pre>
|
||||
Log log = LogFactory.getLog("Foo");
|
||||
Log log = LogFactory.getLog(Foo.class);
|
||||
</pre>
|
||||
|
||||
<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 {
|
||||
|
||||
protected static Log log =
|
||||
LogFactory.getLog("my.component");
|
||||
LogFactory.getLog(MyComponent.class);
|
||||
|
||||
// Called once at startup time
|
||||
public void start() {
|
||||
|
||||
Reference in New Issue
Block a user