1
0

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:
Robert Burrell Donkin
2004-02-28 17:54:14 +00:00
parent b8683537ac
commit c83a3e1b5a
11 changed files with 142 additions and 142 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/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();

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/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 $
* *
* ==================================================================== * ====================================================================
* *
@@ -79,7 +79,7 @@ import java.util.Properties;
* <p>Factory for creating {@link Log} instances, with discovery and * <p>Factory for creating {@link Log} instances, with discovery and
* configuration features similar to that employed by standard Java APIs * configuration features similar to that employed by standard Java APIs
* such as JAXP.</p> * such as JAXP.</p>
* *
* <p><strong>IMPLEMENTATION NOTE</strong> - This implementation is heavily * <p><strong>IMPLEMENTATION NOTE</strong> - This implementation is heavily
* based on the SAXParserFactory and DocumentBuilderFactory implementations * based on the SAXParserFactory and DocumentBuilderFactory implementations
* (corresponding to the JAXP pluggability APIs) found in Apache Xerces.</p> * (corresponding to the JAXP pluggability APIs) found in Apache Xerces.</p>
@@ -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 {
@@ -117,7 +117,7 @@ public abstract class LogFactory {
"commons-logging.properties"; "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 ) * ( http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html )
*/ */
protected static final String SERVICE_ID = protected static final String SERVICE_ID =
@@ -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 {
@@ -290,7 +290,7 @@ public abstract class LogFactory {
} catch (SecurityException e) { } catch (SecurityException e) {
} }
// First, try the system property // First, try the system property
try { try {
String factoryClass = System.getProperty(FACTORY_PROPERTY); 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 // 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) {
@@ -322,13 +322,13 @@ public abstract class LogFactory {
} catch (java.io.UnsupportedEncodingException e) { } catch (java.io.UnsupportedEncodingException e) {
rd = new BufferedReader(new InputStreamReader(is)); rd = new BufferedReader(new InputStreamReader(is));
} }
String factoryClassName = rd.readLine(); String factoryClassName = rd.readLine();
rd.close(); rd.close();
if (factoryClassName != null && if (factoryClassName != null &&
! "".equals(factoryClassName)) { ! "".equals(factoryClassName)) {
factory= newFactory( factoryClassName, contextClassLoader ); 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 // If the properties file exists, it'll be read and the properties
// used. IMHO ( costin ) System property and JDK1.3 jar service // used. IMHO ( costin ) System property and JDK1.3 jar service
// should be enough for detecting the class name. The properties // should be enough for detecting the class name. The properties
@@ -359,10 +359,10 @@ public abstract class LogFactory {
if (factory == null) { if (factory == null) {
factory = newFactory(FACTORY_DEFAULT, LogFactory.class.getClassLoader()); factory = newFactory(FACTORY_DEFAULT, LogFactory.class.getClassLoader());
} }
if (factory != null) { if (factory != null) {
/** /**
* Always cache using context class loader.. * Always cache using context class loader.
*/ */
cacheFactory(contextClassLoader, factory); cacheFactory(contextClassLoader, factory);
@@ -375,7 +375,7 @@ public abstract class LogFactory {
} }
} }
} }
return factory; return 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.
@@ -465,7 +465,7 @@ public abstract class LogFactory {
/** /**
* Return the thread context class loader if available. * Return the thread context class loader if available.
* Otherwise return null. * Otherwise return null.
* *
* The thread context class loader is available for JDK 1.2 * The thread context class loader is available for JDK 1.2
* or later, if certain security conditions are met. * or later, if certain security conditions are met.
* *
@@ -492,12 +492,12 @@ public abstract class LogFactory {
* InvocationTargetException is thrown by 'invoke' when * InvocationTargetException is thrown by 'invoke' when
* the method being invoked (getContextClassLoader) throws * the method being invoked (getContextClassLoader) throws
* an exception. * an exception.
* *
* getContextClassLoader() throws SecurityException when * getContextClassLoader() throws SecurityException when
* the context class loader isn't an ancestor of the * the context class loader isn't an ancestor of the
* calling class's class loader, or if security * calling class's class loader, or if security
* permissions are restricted. * permissions are restricted.
* *
* In the first case (not related), we want to ignore and * In the first case (not related), we want to ignore and
* keep going. We cannot help but also ignore the second * keep going. We cannot help but also ignore the second
* with the logic below, but other calls elsewhere (to * 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) private static LogFactory getCachedFactory(ClassLoader contextClassLoader)
{ {
LogFactory factory = null; LogFactory factory = null;
if (contextClassLoader != null) if (contextClassLoader != null)
factory = (LogFactory) factories.get(contextClassLoader); factory = (LogFactory) factories.get(contextClassLoader);
return factory; return factory;
} }
private static void cacheFactory(ClassLoader classLoader, LogFactory factory) private static void cacheFactory(ClassLoader classLoader, LogFactory factory)
{ {
if (classLoader != null && factory != null) if (classLoader != null && factory != null)
@@ -562,18 +562,18 @@ public abstract class LogFactory {
new PrivilegedAction() { new PrivilegedAction() {
public Object run() { public Object run() {
// This will be used to diagnose bad configurations // 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; Class logFactoryClass = null;
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();
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
if (classLoader == LogFactory.class.getClassLoader()) { if (classLoader == LogFactory.class.getClassLoader()) {
// Nothing more to try, onwards. // Nothing more to try, onwards.
@@ -585,39 +585,39 @@ public abstract class LogFactory {
// Nothing more to try, onwards. // Nothing more to try, onwards.
throw e; throw e;
} }
} catch(ClassCastException e){ } catch(ClassCastException e){
if (classLoader == LogFactory.class.getClassLoader()) { if (classLoader == LogFactory.class.getClassLoader()) {
// Nothing more to try, onwards (bug in loader implementation). // Nothing more to try, onwards (bug in loader implementation).
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:
* a) LogFactory.class.getClassLoader() may return 'null' * a) LogFactory.class.getClassLoader() may return 'null'
* if LogFactory is loaded by the bootstrap classloader. * if LogFactory is loaded by the bootstrap classloader.
* 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(
"The chosen LogFactory implementation does not extend LogFactory." "The chosen LogFactory implementation does not extend LogFactory."
+ " Please check your configuration.", + " Please check your configuration.",
e); e);
} }
return new LogConfigurationException(e); return new LogConfigurationException(e);
@@ -627,10 +627,10 @@ public abstract class LogFactory {
if (result instanceof LogConfigurationException) if (result instanceof LogConfigurationException)
throw (LogConfigurationException)result; throw (LogConfigurationException)result;
return (LogFactory)result; return (LogFactory)result;
} }
private static InputStream getResourceAsStream(final ClassLoader loader, private static InputStream getResourceAsStream(final ClassLoader loader,
final String name) final String name)
{ {

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.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 */

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/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 $
* *
* ==================================================================== * ====================================================================
* *
@@ -66,11 +66,11 @@ import org.apache.avalon.framework.logger.Logger;
import org.apache.commons.logging.Log; 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 {
@@ -79,7 +79,7 @@ public class AvalonLogger implements Log, Serializable {
private String name = null; 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) { public AvalonLogger(Logger logger) {
this.name = name; 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) { public AvalonLogger(String name) {
if (defaultLogger == null) if (defaultLogger == null)
throw new NullPointerException("default logger has to be specified if this constructor is used!"); throw new NullPointerException("default logger has to be specified if this constructor is used!");
this.logger = getLogger(); this.logger = getLogger();
} }

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/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));

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.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 {
@@ -86,7 +86,7 @@ public final class Log4JCategoryLog implements Log {
/** The fully qualified name of the Log4JCategoryLog class. */ /** The fully qualified name of the Log4JCategoryLog class. */
private static final String FQCN = Log4JCategoryLog.class.getName(); private static final String FQCN = Log4JCategoryLog.class.getName();
/** Log to this category */ /** Log to this category */
private Category category = null; private Category category = null;
@@ -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;

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/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 {
@@ -85,7 +85,7 @@ public class Log4JLogger implements Log, Serializable {
/** The fully qualified name of the Log4JLogger class. */ /** The fully qualified name of the Log4JLogger class. */
private static final String FQCN = Log4JLogger.class.getName(); private static final String FQCN = Log4JLogger.class.getName();
/** Log to this logger */ /** Log to this logger */
private transient Logger logger = null; private transient Logger logger = null;
@@ -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();

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/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.
@@ -173,7 +173,7 @@ public final class Log4jFactory extends LogFactory {
instances.clear(); instances.clear();
// what's the log4j mechanism to cleanup ??? // what's the log4j mechanism to cleanup ???
} }

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.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.

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/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 {
@@ -158,7 +158,7 @@ public class SimpleLog implements Log, Serializable {
public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1); public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1);
// ------------------------------------------------------------ Initializer // ------------------------------------------------------------ Initializer
private static String getStringProperty(String name) { private static String getStringProperty(String name) {
String prop = null; String prop = null;
try { try {
@@ -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,23 +330,23 @@ 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());
buf.append(">"); buf.append(">");
java.io.StringWriter sw= new java.io.StringWriter(1024); java.io.StringWriter sw= new java.io.StringWriter(1024);
java.io.PrintWriter pw= new java.io.PrintWriter(sw); java.io.PrintWriter pw= new java.io.PrintWriter(sw);
t.printStackTrace(pw); t.printStackTrace(pw);
pw.close(); pw.close();
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) {
@@ -579,7 +579,7 @@ public class SimpleLog implements Log, Serializable {
/** /**
* Return the thread context class loader if available. * Return the thread context class loader if available.
* Otherwise return null. * Otherwise return null.
* *
* The thread context class loader is available for JDK 1.2 * The thread context class loader is available for JDK 1.2
* or later, if certain security conditions are met. * or later, if certain security conditions are met.
* *
@@ -594,7 +594,7 @@ public class SimpleLog implements Log, Serializable {
try { try {
// Are we running on a JDK 1.2 or later system? // Are we running on a JDK 1.2 or later system?
Method method = Thread.class.getMethod("getContextClassLoader", null); Method method = Thread.class.getMethod("getContextClassLoader", null);
// Get the thread context class loader (if there is one) // Get the thread context class loader (if there is one)
try { try {
classLoader = (ClassLoader)method.invoke(Thread.currentThread(), null); classLoader = (ClassLoader)method.invoke(Thread.currentThread(), null);
@@ -605,12 +605,12 @@ public class SimpleLog implements Log, Serializable {
* InvocationTargetException is thrown by 'invoke' when * InvocationTargetException is thrown by 'invoke' when
* the method being invoked (getContextClassLoader) throws * the method being invoked (getContextClassLoader) throws
* an exception. * an exception.
* *
* getContextClassLoader() throws SecurityException when * getContextClassLoader() throws SecurityException when
* the context class loader isn't an ancestor of the * the context class loader isn't an ancestor of the
* calling class's class loader, or if security * calling class's class loader, or if security
* permissions are restricted. * permissions are restricted.
* *
* In the first case (not related), we want to ignore and * In the first case (not related), we want to ignore and
* keep going. We cannot help but also ignore the second * keep going. We cannot help but also ignore the second
* with the logic below, but other calls elsewhere (to * with the logic below, but other calls elsewhere (to
@@ -631,7 +631,7 @@ public class SimpleLog implements Log, Serializable {
; // ignore ; // ignore
} }
} }
if (classLoader == null) { if (classLoader == null) {
classLoader = SimpleLog.class.getClassLoader(); classLoader = SimpleLog.class.getClassLoader();
} }
@@ -639,7 +639,7 @@ public class SimpleLog implements Log, Serializable {
// Return the selected class loader // Return the selected class loader
return classLoader; return classLoader;
} }
private static InputStream getResourceAsStream(final String name) private static InputStream getResourceAsStream(final String name)
{ {
return (InputStream)AccessController.doPrivileged( return (InputStream)AccessController.doPrivileged(

View File

@@ -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
@@ -152,8 +152,8 @@ configuration information for this default implementation.</p>
<h4>Configuring the Underlying Logging System</h4> <h4>Configuring the Underlying Logging System</h4>
<p>The basic principle is that the user is totally responsible for the <p>The basic principle is that the user is totally responsible for the
configuration of the underlying logging system. configuration of the underlying logging system.
Commons-logging should not change the existing configuration.</p> Commons-logging should not change the existing configuration.</p>
<p>Each individual <a href="Log.html">Log</a> implementation may <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 <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() {