1
0

More javadoc and formatting fixes.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1432453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart
2013-01-12 15:29:22 +00:00
parent 03fced4b61
commit 592868b494
9 changed files with 97 additions and 353 deletions

View File

@@ -21,12 +21,10 @@ import org.apache.avalon.framework.logger.Logger;
import org.apache.commons.logging.Log;
/**
* <p>Implementation of commons-logging Log interface that delegates all
* Implementation of commons-logging Log interface that delegates all
* logging calls to the Avalon logging abstraction: the Logger interface.
* </p>
* <p>
* There are two ways in which this class can be used:
* </p>
* <ul>
* <li>the instance can be constructed with an Avalon logger
* (by calling {@link #AvalonLogger(Logger)}). In this case, it acts
@@ -34,7 +32,7 @@ import org.apache.commons.logging.Log;
* particularly useful when using a property setter.
* </li>
* <li>the {@link #setDefaultLogger} class property can be called which
* sets the ancesteral Avalon logger for this class. Any <code>AvalonLogger</code>
* sets the ancestral Avalon logger for this class. Any <code>AvalonLogger</code>
* instances created through the <code>LogFactory</code> mechanisms will output
* to child loggers of this <code>Logger</code>.
* </li>
@@ -48,20 +46,21 @@ import org.apache.commons.logging.Log;
* commons-logging, but this never actually worked (a NullPointerException would
* be thrown as soon as the deserialized object was used), so removing this marker
* is not considered to be an incompatible change.
* </p>
*
* @author <a href="mailto:neeme@apache.org">Neeme Praks</a>
* @version $Id$
*/
public class AvalonLogger implements Log {
/** Ancestral Avalon logger */
/** Ancestral Avalon logger. */
private static Logger defaultLogger = null;
/** Avalon logger used to perform log */
/** Avalon logger used to perform log. */
private final transient Logger logger;
/**
* Constructs an <code>AvalonLogger</code> that outputs to the given
* <code>Logger</code> instance.
*
* @param logger the Avalon logger implementation to delegate to
*/
public AvalonLogger(Logger logger) {
@@ -71,6 +70,7 @@ public class AvalonLogger implements Log {
/**
* Constructs an <code>AvalonLogger</code> that will log to a child
* of the <code>Logger</code> set by calling {@link #setDefaultLogger}.
*
* @param name the name of the avalon logger implementation to delegate to
*/
public AvalonLogger(String name) {
@@ -81,6 +81,7 @@ public class AvalonLogger implements Log {
/**
* Gets the Avalon logger implementation used to perform logging.
*
* @return avalon logger implementation
*/
public Logger getLogger() {
@@ -88,9 +89,9 @@ public class AvalonLogger implements Log {
}
/**
* Sets the ancesteral Avalon logger from which the delegating loggers
* will descend.
* @param logger the default avalon logger,
* Sets the ancestral Avalon logger from which the delegating loggers will descend.
*
* @param logger the default avalon logger,
* in case there is no logger instance supplied in constructor
*/
public static void setDefaultLogger(Logger logger) {
@@ -98,8 +99,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.debug</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.debug</code>.
*
* @param message to log
* @param t log this cause
@@ -110,8 +110,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.debug</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.debug</code>.
*
* @param message to log.
* @see org.apache.commons.logging.Log#debug(Object)
@@ -121,8 +120,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.error</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.error</code>.
*
* @param message to log
* @param t log this cause
@@ -133,8 +131,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.error</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.error</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#error(Object)
@@ -144,8 +141,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.fatalError</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.fatalError</code>.
*
* @param message to log.
* @param t log this cause.
@@ -156,8 +152,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.fatalError</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.fatalError</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#fatal(Object)
@@ -167,8 +162,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.info</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.info</code>.
*
* @param message to log
* @param t log this cause
@@ -179,8 +173,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.info</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.info</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#info(Object)
@@ -190,8 +183,7 @@ public class AvalonLogger implements Log {
}
/**
* Is logging to
* <code>org.apache.avalon.framework.logger.Logger.debug</code> enabled?
* Is logging to <code>org.apache.avalon.framework.logger.Logger.debug</code> enabled?
* @see org.apache.commons.logging.Log#isDebugEnabled()
*/
public boolean isDebugEnabled() {
@@ -199,8 +191,7 @@ public class AvalonLogger implements Log {
}
/**
* Is logging to
* <code>org.apache.avalon.framework.logger.Logger.error</code> enabled?
* Is logging to <code>org.apache.avalon.framework.logger.Logger.error</code> enabled?
* @see org.apache.commons.logging.Log#isErrorEnabled()
*/
public boolean isErrorEnabled() {
@@ -208,8 +199,7 @@ public class AvalonLogger implements Log {
}
/**
* Is logging to
* <code>org.apache.avalon.framework.logger.Logger.fatalError</code> enabled?
* Is logging to <code>org.apache.avalon.framework.logger.Logger.fatalError</code> enabled?
* @see org.apache.commons.logging.Log#isFatalEnabled()
*/
public boolean isFatalEnabled() {
@@ -217,8 +207,7 @@ public class AvalonLogger implements Log {
}
/**
* Is logging to
* <code>org.apache.avalon.framework.logger.Logger.info</code> enabled?
* Is logging to <code>org.apache.avalon.framework.logger.Logger.info</code> enabled?
* @see org.apache.commons.logging.Log#isInfoEnabled()
*/
public boolean isInfoEnabled() {
@@ -226,8 +215,7 @@ public class AvalonLogger implements Log {
}
/**
* Is logging to
* <code>org.apache.avalon.framework.logger.Logger.debug</code> enabled?
* Is logging to <code>org.apache.avalon.framework.logger.Logger.debug</code> enabled?
* @see org.apache.commons.logging.Log#isTraceEnabled()
*/
public boolean isTraceEnabled() {
@@ -235,8 +223,7 @@ public class AvalonLogger implements Log {
}
/**
* Is logging to
* <code>org.apache.avalon.framework.logger.Logger.warn</code> enabled?
* Is logging to <code>org.apache.avalon.framework.logger.Logger.warn</code> enabled?
* @see org.apache.commons.logging.Log#isWarnEnabled()
*/
public boolean isWarnEnabled() {
@@ -244,8 +231,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.debug</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.debug</code>.
*
* @param message to log.
* @param t log this cause.
@@ -256,8 +242,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.debug</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.debug</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#trace(Object)
@@ -267,8 +252,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.warn</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.warn</code>.
*
* @param message to log
* @param t log this cause
@@ -279,8 +263,7 @@ public class AvalonLogger implements Log {
}
/**
* Logs a message with
* <code>org.apache.avalon.framework.logger.Logger.warn</code>.
* Logs a message with <code>org.apache.avalon.framework.logger.Logger.warn</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#warn(Object)
@@ -288,5 +271,4 @@ public class AvalonLogger implements Log {
public void warn(Object message) {
if (getLogger().isWarnEnabled()) getLogger().warn(String.valueOf(message));
}
}

View File

@@ -15,10 +15,8 @@
* limitations under the License.
*/
package org.apache.commons.logging.impl;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -29,7 +27,6 @@ import java.io.StringWriter;
import org.apache.commons.logging.Log;
/**
* <p>Implementation of the <code>org.apache.commons.logging.Log</code>
* interface that wraps the standard JDK logging mechanisms that are
@@ -44,10 +41,8 @@ import org.apache.commons.logging.Log;
*/
public class Jdk13LumberjackLogger implements Log, Serializable {
// ----------------------------------------------------- Instance Variables
/**
* The underlying Logger implementation we are using.
*/
@@ -57,7 +52,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
private String sourceMethodName = "unknown";
private boolean classAndMethodFound = false;
/**
* This member variable simply ensures that any attempt to initialise
* this class in a pre-1.4 JVM will result in an ExceptionInInitializerError.
@@ -68,23 +62,18 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
// ----------------------------------------------------------- Constructors
/**
* Construct a named instance of this Logger.
*
* @param name Name of the logger to be constructed
*/
public Jdk13LumberjackLogger(String name) {
this.name = name;
logger = getLogger();
}
// --------------------------------------------------------- Public Methods
private void log( Level level, String msg, Throwable ex ) {
if( getLogger().isLoggable(level) ) {
LogRecord record = new LogRecord(level, msg);
@@ -101,8 +90,8 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
}
/**
* <p>Gets the class and method by looking at the stack trace for the
* first entry that is not this class.</p>
* Gets the class and method by looking at the stack trace for the
* first entry that is not this class.
*/
private void getClassAndMethod() {
try {
@@ -144,7 +133,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.FINE, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.FINE</code>.
*
@@ -156,7 +144,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.FINE, String.valueOf(message), exception);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -167,7 +154,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -179,7 +165,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), exception);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -190,7 +175,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -202,7 +186,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), exception);
}
/**
* Return the native Logger instance we are using.
*/
@@ -213,7 +196,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
return logger;
}
/**
* Logs a message with <code>java.util.logging.Level.INFO</code>.
*
@@ -224,7 +206,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.INFO, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.INFO</code>.
*
@@ -236,7 +217,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.INFO, String.valueOf(message), exception);
}
/**
* Is debug logging currently enabled?
*/
@@ -244,7 +224,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
return getLogger().isLoggable(Level.FINE);
}
/**
* Is error logging currently enabled?
*/
@@ -252,7 +231,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
return getLogger().isLoggable(Level.SEVERE);
}
/**
* Is fatal logging currently enabled?
*/
@@ -260,7 +238,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
return getLogger().isLoggable(Level.SEVERE);
}
/**
* Is info logging currently enabled?
*/
@@ -268,7 +245,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
return getLogger().isLoggable(Level.INFO);
}
/**
* Is trace logging currently enabled?
*/
@@ -276,7 +252,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
return getLogger().isLoggable(Level.FINEST);
}
/**
* Is warn logging currently enabled?
*/
@@ -284,7 +259,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
return getLogger().isLoggable(Level.WARNING);
}
/**
* Logs a message with <code>java.util.logging.Level.FINEST</code>.
*
@@ -295,7 +269,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.FINEST, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.FINEST</code>.
*
@@ -307,7 +280,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.FINEST, String.valueOf(message), exception);
}
/**
* Logs a message with <code>java.util.logging.Level.WARNING</code>.
*
@@ -318,7 +290,6 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
log(Level.WARNING, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.WARNING</code>.
*
@@ -329,6 +300,4 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
public void warn(Object message, Throwable exception) {
log(Level.WARNING, String.valueOf(message), exception);
}
}

View File

@@ -15,21 +15,18 @@
* limitations under the License.
*/
package org.apache.commons.logging.impl;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.logging.Log;
/**
* <p>Implementation of the <code>org.apache.commons.logging.Log</code>
* Implementation of the <code>org.apache.commons.logging.Log</code>
* interface that wraps the standard JDK logging mechanisms that were
* introduced in the Merlin release (JDK 1.4).</p>
* introduced in the Merlin release (JDK 1.4).
*
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
@@ -48,39 +45,31 @@ public class Jdk14Logger implements Log, Serializable {
// ----------------------------------------------------------- Constructors
/**
* Construct a named instance of this Logger.
*
* @param name Name of the logger to be constructed
*/
public Jdk14Logger(String name) {
this.name = name;
logger = getLogger();
}
// ----------------------------------------------------- Instance Variables
/**
* The underlying Logger implementation we are using.
*/
protected transient Logger logger = null;
/**
* The name of the logger we are wrapping.
*/
protected String name = null;
// --------------------------------------------------------- Public Methods
private void log( Level level, String msg, Throwable ex ) {
Logger logger = getLogger();
if (logger.isLoggable(level)) {
// Hack (?) to get the stack trace.
@@ -100,7 +89,6 @@ public class Jdk14Logger implements Log, Serializable {
logger.logp( level, cname, method, msg, ex );
}
}
}
/**
@@ -113,7 +101,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.FINE, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.FINE</code>.
*
@@ -125,7 +112,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.FINE, String.valueOf(message), exception);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -136,7 +122,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -148,7 +133,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), exception);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -159,7 +143,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.SEVERE</code>.
*
@@ -171,7 +154,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.SEVERE, String.valueOf(message), exception);
}
/**
* Return the native Logger instance we are using.
*/
@@ -182,7 +164,6 @@ public class Jdk14Logger implements Log, Serializable {
return logger;
}
/**
* Logs a message with <code>java.util.logging.Level.INFO</code>.
*
@@ -193,7 +174,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.INFO, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.INFO</code>.
*
@@ -205,7 +185,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.INFO, String.valueOf(message), exception);
}
/**
* Is debug logging currently enabled?
*/
@@ -213,7 +192,6 @@ public class Jdk14Logger implements Log, Serializable {
return getLogger().isLoggable(Level.FINE);
}
/**
* Is error logging currently enabled?
*/
@@ -221,7 +199,6 @@ public class Jdk14Logger implements Log, Serializable {
return getLogger().isLoggable(Level.SEVERE);
}
/**
* Is fatal logging currently enabled?
*/
@@ -229,7 +206,6 @@ public class Jdk14Logger implements Log, Serializable {
return getLogger().isLoggable(Level.SEVERE);
}
/**
* Is info logging currently enabled?
*/
@@ -237,7 +213,6 @@ public class Jdk14Logger implements Log, Serializable {
return getLogger().isLoggable(Level.INFO);
}
/**
* Is trace logging currently enabled?
*/
@@ -245,7 +220,6 @@ public class Jdk14Logger implements Log, Serializable {
return getLogger().isLoggable(Level.FINEST);
}
/**
* Is warn logging currently enabled?
*/
@@ -253,7 +227,6 @@ public class Jdk14Logger implements Log, Serializable {
return getLogger().isLoggable(Level.WARNING);
}
/**
* Logs a message with <code>java.util.logging.Level.FINEST</code>.
*
@@ -264,7 +237,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.FINEST, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.FINEST</code>.
*
@@ -276,7 +248,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.FINEST, String.valueOf(message), exception);
}
/**
* Logs a message with <code>java.util.logging.Level.WARNING</code>.
*
@@ -287,7 +258,6 @@ public class Jdk14Logger implements Log, Serializable {
log(Level.WARNING, String.valueOf(message), null);
}
/**
* Logs a message with <code>java.util.logging.Level.WARNING</code>.
*
@@ -298,6 +268,4 @@ public class Jdk14Logger implements Log, Serializable {
public void warn(Object message, Throwable exception) {
log(Level.WARNING, String.valueOf(message), exception);
}
}

View File

@@ -15,7 +15,6 @@
* limitations under the License.
*/
package org.apache.commons.logging.impl;
import java.io.Serializable;
@@ -95,14 +94,12 @@ public class Log4JLogger implements Log, Serializable {
traceLevel = _traceLevel;
}
// ------------------------------------------------------------ Constructor
public Log4JLogger() {
name = null;
}
/**
* Base constructor.
*/
@@ -123,7 +120,6 @@ public class Log4JLogger implements Log, Serializable {
this.logger=logger;
}
/**
* Logs a message with <code>org.apache.log4j.Priority.TRACE</code>.
* When using a log4j version that does not support the <code>TRACE</code>
@@ -136,7 +132,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, traceLevel, message, null );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.TRACE</code>.
* When using a log4j version that does not support the <code>TRACE</code>
@@ -150,7 +145,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, traceLevel, message, t );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.DEBUG</code>.
*
@@ -172,7 +166,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.DEBUG, message, t );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.INFO</code>.
*
@@ -183,7 +176,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.INFO, message, null );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.INFO</code>.
*
@@ -195,7 +187,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.INFO, message, t );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.WARN</code>.
*
@@ -206,7 +197,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.WARN, message, null );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.WARN</code>.
*
@@ -218,7 +208,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.WARN, message, t );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.ERROR</code>.
*
@@ -229,7 +218,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.ERROR, message, null );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.ERROR</code>.
*
@@ -241,7 +229,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.ERROR, message, t );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.FATAL</code>.
*
@@ -252,7 +239,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.FATAL, message, null );
}
/**
* Logs a message with <code>org.apache.log4j.Priority.FATAL</code>.
*
@@ -264,7 +250,6 @@ public class Log4JLogger implements Log, Serializable {
getLogger().log(FQCN, Level.FATAL, message, t );
}
/**
* Return the native Logger instance we are using.
*/
@@ -275,7 +260,6 @@ public class Log4JLogger implements Log, Serializable {
return this.logger;
}
/**
* Check whether the Log4j Logger used is enabled for <code>DEBUG</code> priority.
*/
@@ -283,15 +267,13 @@ public class Log4JLogger implements Log, Serializable {
return getLogger().isDebugEnabled();
}
/**
/**
* Check whether the Log4j Logger used is enabled for <code>ERROR</code> priority.
*/
public boolean isErrorEnabled() {
return getLogger().isEnabledFor(Level.ERROR);
}
/**
* Check whether the Log4j Logger used is enabled for <code>FATAL</code> priority.
*/
@@ -299,7 +281,6 @@ public class Log4JLogger implements Log, Serializable {
return getLogger().isEnabledFor(Level.FATAL);
}
/**
* Check whether the Log4j Logger used is enabled for <code>INFO</code> priority.
*/
@@ -307,7 +288,6 @@ public class Log4JLogger implements Log, Serializable {
return getLogger().isInfoEnabled();
}
/**
* Check whether the Log4j Logger used is enabled for <code>TRACE</code> priority.
* When using a log4j version that does not support the TRACE level, this call

View File

@@ -17,7 +17,6 @@
package org.apache.commons.logging.impl;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -30,7 +29,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogConfigurationException;
import org.apache.commons.logging.LogFactory;
/**
* <p>Concrete subclass of {@link LogFactory} that implements the
* following algorithm to dynamically select a logging implementation
@@ -67,7 +65,6 @@ import org.apache.commons.logging.LogFactory;
*/
public class LogFactoryImpl extends LogFactory {
/** Log4JLogger class name */
private static final String LOGGING_IMPL_LOG4J_LOGGER = "org.apache.commons.logging.impl.Log4JLogger";
/** Jdk14Logger class name */
@@ -82,8 +79,6 @@ public class LogFactoryImpl extends LogFactory {
// ----------------------------------------------------------- Constructors
/**
* Public no-arguments constructor required by the lookup mechanism.
*/
@@ -95,24 +90,19 @@ public class LogFactoryImpl extends LogFactory {
}
}
// ----------------------------------------------------- Manifest Constants
/**
* The name (<code>org.apache.commons.logging.Log</code>) of the system
* property identifying our {@link Log} implementation class.
*/
public static final String LOG_PROPERTY =
"org.apache.commons.logging.Log";
public static final String LOG_PROPERTY = "org.apache.commons.logging.Log";
/**
* The deprecated system property used for backwards compatibility with
* old versions of JCL.
*/
protected static final String LOG_PROPERTY_OLD =
"org.apache.commons.logging.log";
protected static final String LOG_PROPERTY_OLD = "org.apache.commons.logging.log";
/**
* The name (<code>org.apache.commons.logging.Log.allowFlawedContext</code>)
@@ -161,7 +151,6 @@ public class LogFactoryImpl extends LogFactory {
public static final String ALLOW_FLAWED_HIERARCHY_PROPERTY =
"org.apache.commons.logging.Log.allowFlawedHierarchy";
/**
* The names of classes that will be tried (in order) as logging
* adapters. Each class is expected to implement the Log interface,
@@ -177,7 +166,6 @@ public class LogFactoryImpl extends LogFactory {
"org.apache.commons.logging.impl.SimpleLog"
};
// ----------------------------------------------------- Instance Variables
/**
@@ -191,26 +179,22 @@ public class LogFactoryImpl extends LogFactory {
*/
private String diagnosticPrefix;
/**
* Configuration attributes.
*/
protected Hashtable attributes = new Hashtable();
/**
* The {@link org.apache.commons.logging.Log} instances that have
* already been created, keyed by logger name.
*/
protected Hashtable instances = new Hashtable();
/**
* Name of the class implementing the Log interface.
*/
private String logClassName;
/**
* The one-argument constructor of the
* {@link org.apache.commons.logging.Log}
@@ -220,13 +204,10 @@ public class LogFactoryImpl extends LogFactory {
*/
protected Constructor logConstructor = null;
/**
* The signature of the Constructor to be used.
*/
protected Class logConstructorSignature[] =
{ java.lang.String.class };
protected Class logConstructorSignature[] = { java.lang.String.class };
/**
* The one-argument <code>setLogFactory</code> method of the selected
@@ -234,12 +215,10 @@ public class LogFactoryImpl extends LogFactory {
*/
protected Method logMethod = null;
/**
* The signature of the <code>setLogFactory</code> method to be used.
*/
protected Class logMethodSignature[] =
{ LogFactory.class };
protected Class logMethodSignature[] = { LogFactory.class };
/**
* See getBaseClassLoader and initConfiguration.
@@ -258,7 +237,6 @@ public class LogFactoryImpl extends LogFactory {
// --------------------------------------------------------- Public Methods
/**
* Return the configuration attribute with the specified name (if any),
* or <code>null</code> if there is no such attribute.
@@ -266,12 +244,9 @@ public class LogFactoryImpl extends LogFactory {
* @param name Name of the attribute to return
*/
public Object getAttribute(String name) {
return attributes.get(name);
}
/**
* Return an array containing the names of all currently defined
* configuration attributes. If there are no such attributes, a zero
@@ -281,7 +256,6 @@ public class LogFactoryImpl extends LogFactory {
return (String[]) attributes.keySet().toArray(new String[attributes.size()]);
}
/**
* Convenience method to derive a name from the specified class and
* call <code>getInstance(String)</code> with it.
@@ -292,12 +266,9 @@ public class LogFactoryImpl extends LogFactory {
* instance cannot be returned
*/
public Log getInstance(Class clazz) throws LogConfigurationException {
return getInstance(clazz.getName());
}
/**
* <p>Construct (if necessary) and return a <code>Log</code> instance,
* using the factory's current set of configuration attributes.</p>
@@ -316,17 +287,14 @@ public class LogFactoryImpl extends LogFactory {
* instance cannot be returned
*/
public Log getInstance(String name) throws LogConfigurationException {
Log instance = (Log) instances.get(name);
if (instance == null) {
instance = newInstance(name);
instances.put(name, instance);
}
return instance;
}
/**
* Release any internal references to previously created
* {@link org.apache.commons.logging.Log}
@@ -341,7 +309,6 @@ public class LogFactoryImpl extends LogFactory {
instances.clear();
}
/**
* Remove any configuration attribute associated with the specified name.
* If there is no such attribute, no action is taken.
@@ -349,12 +316,9 @@ public class LogFactoryImpl extends LogFactory {
* @param name Name of the attribute to remove
*/
public void removeAttribute(String name) {
attributes.remove(name);
}
/**
* Set the configuration attribute with the specified name. Calling
* this with a <code>null</code> value is equivalent to calling
@@ -380,7 +344,6 @@ public class LogFactoryImpl extends LogFactory {
* to remove any setting for this attribute
*/
public void setAttribute(String name, Object value) {
if (logConstructor != null) {
logDiagnostic("setAttribute: call too late; configuration already performed.");
}
@@ -394,10 +357,8 @@ public class LogFactoryImpl extends LogFactory {
if (name.equals(TCCL_KEY)) {
useTCCL = value != null && Boolean.valueOf(value.toString()).booleanValue();
}
}
// ------------------------------------------------------
// Static Methods
//
@@ -413,7 +374,6 @@ public class LogFactoryImpl extends LogFactory {
protected static ClassLoader getContextClassLoader() throws LogConfigurationException {
return LogFactory.getContextClassLoader();
}
/**
* Workaround for bug in Java1.2; in theory this method is not needed.
@@ -422,7 +382,6 @@ public class LogFactoryImpl extends LogFactory {
protected static boolean isDiagnosticsEnabled() {
return LogFactory.isDiagnosticsEnabled();
}
/**
* Workaround for bug in Java1.2; in theory this method is not needed.
@@ -433,7 +392,6 @@ public class LogFactoryImpl extends LogFactory {
return LogFactory.getClassLoader(clazz);
}
// ------------------------------------------------------ Protected Methods
/**
@@ -472,7 +430,6 @@ public class LogFactoryImpl extends LogFactory {
}
diagnosticPrefix = "[LogFactoryImpl@" + System.identityHashCode(this) + " from " + classLoaderName + "] ";
}
/**
* Output a diagnostic message to a user-specified destination (if the
@@ -495,7 +452,6 @@ public class LogFactoryImpl extends LogFactory {
* it will be.
*/
protected String getLogClassName() {
if (logClassName == null) {
discoverLogImplementation(getClass().getName());
}
@@ -529,7 +485,6 @@ public class LogFactoryImpl extends LogFactory {
return logConstructor;
}
/**
* Is <em>JDK 1.3 with Lumberjack</em> logging available?
@@ -543,7 +498,6 @@ public class LogFactoryImpl extends LogFactory {
"org.apache.commons.logging.impl.Jdk13LumberjackLogger");
}
/**
* <p>Return <code>true</code> if <em>JDK 1.4 or later</em> logging
* is available. Also checks that the <code>Throwable</code> class
@@ -559,7 +513,6 @@ public class LogFactoryImpl extends LogFactory {
"org.apache.commons.logging.impl.Jdk14Logger");
}
/**
* Is a <em>Log4J</em> implementation available?
*
@@ -572,7 +525,6 @@ public class LogFactoryImpl extends LogFactory {
LOGGING_IMPL_LOG4J_LOGGER);
}
/**
* Create and return a new {@link org.apache.commons.logging.Log}
* instance for the specified name.
@@ -583,7 +535,6 @@ public class LogFactoryImpl extends LogFactory {
* be created
*/
protected Log newInstance(String name) throws LogConfigurationException {
Log instance;
try {
if (logConstructor == null) {
@@ -619,7 +570,6 @@ public class LogFactoryImpl extends LogFactory {
throw new LogConfigurationException(t);
}
}
// ------------------------------------------------------ Private Methods
@@ -642,7 +592,7 @@ public class LogFactoryImpl extends LogFactory {
* allow this class to access the context classloader.
*/
private static ClassLoader getContextClassLoaderInternal()
throws LogConfigurationException {
throws LogConfigurationException {
return (ClassLoader)AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
@@ -661,7 +611,7 @@ public class LogFactoryImpl extends LogFactory {
* info to access data that should not be available to it.
*/
private static String getSystemProperty(final String key, final String def)
throws SecurityException {
throws SecurityException {
return (String) AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
@@ -806,7 +756,6 @@ public class LogFactoryImpl extends LogFactory {
allowFlawedDiscovery = getBooleanConfiguration(ALLOW_FLAWED_DISCOVERY_PROPERTY, true);
allowFlawedHierarchy = getBooleanConfiguration(ALLOW_FLAWED_HIERARCHY_PROPERTY, true);
}
/**
* Attempts to create a Log instance for the given category name.
@@ -818,8 +767,7 @@ public class LogFactoryImpl extends LogFactory {
* or if no adapter at all can be instantiated
*/
private Log discoverLogImplementation(String logCategory)
throws LogConfigurationException
{
throws LogConfigurationException {
if (isDiagnosticsEnabled()) {
logDiagnostic("Discovering a Log implementation...");
}
@@ -902,7 +850,6 @@ public class LogFactoryImpl extends LogFactory {
return result;
}
/**
* Appends message if the given name is similar to the candidate.
* @param messageBuffer <code>StringBuffer</code> the message should be appended to,
@@ -928,7 +875,6 @@ public class LogFactoryImpl extends LogFactory {
}
}
/**
* Checks system properties and the attribute map for
* a Log implementation specified by the user under the
@@ -936,8 +882,7 @@ public class LogFactoryImpl extends LogFactory {
*
* @return classname specified by the user, or <code>null</code>
*/
private String findUserSpecifiedLogClassName()
{
private String findUserSpecifiedLogClassName() {
if (isDiagnosticsEnabled()) {
logDiagnostic("Trying to get log class from attribute '" + LOG_PROPERTY + "'");
}
@@ -990,7 +935,6 @@ public class LogFactoryImpl extends LogFactory {
return specifiedClass;
}
/**
* Attempts to load the given class, find a suitable constructor,
@@ -1014,7 +958,7 @@ public class LogFactoryImpl extends LogFactory {
private Log createLogFromClass(String logAdapterClassName,
String logCategory,
boolean affectState)
throws LogConfigurationException {
throws LogConfigurationException {
if (isDiagnosticsEnabled()) {
logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'");
@@ -1196,7 +1140,6 @@ public class LogFactoryImpl extends LogFactory {
return logAdapter;
}
/**
* Return the classloader from which we should try to load the logging
* adapter classes.
@@ -1373,7 +1316,6 @@ public class LogFactoryImpl extends LogFactory {
throw new LogConfigurationException(discoveryFlaw);
}
}
/**
* Report a problem loading the log adapter, then either return
@@ -1402,7 +1344,7 @@ public class LogFactoryImpl extends LogFactory {
* should not be recovered from.
*/
private void handleFlawedHierarchy(ClassLoader badClassLoader, Class badClass)
throws LogConfigurationException {
throws LogConfigurationException {
boolean implementsLog = false;
String logInterfaceName = Log.class.getName();

View File

@@ -15,7 +15,6 @@
* limitations under the License.
*/
package org.apache.commons.logging.impl;
import java.io.Serializable;
@@ -24,14 +23,13 @@ import org.apache.log.Hierarchy;
import org.apache.commons.logging.Log;
/**
* <p>Implementation of <code>org.apache.commons.logging.Log</code>
* Implementation of <code>org.apache.commons.logging.Log</code>
* that wraps the <a href="http://avalon.apache.org/logkit/">avalon-logkit</a>
* logging system. Configuration of <code>LogKit</code> is left to the user.
* </p>
*
* <p><code>LogKit</code> accepts only <code>String</code> messages.
* <p>
* <code>LogKit</code> accepts only <code>String</code> messages.
* Therefore, this implementation converts object messages into strings
* by called their <code>toString()</code> method before logging them.</p>
* by called their <code>toString()</code> method before logging them.
*
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
* @author Robert Burrell Donkin
@@ -39,20 +37,16 @@ import org.apache.commons.logging.Log;
*/
public class LogKitLogger implements Log, Serializable {
// ------------------------------------------------------------- Attributes
/** Logging goes to this <code>LogKit</code> logger */
protected transient Logger logger = null;
/** Name of this logger */
protected String name = null;
// ------------------------------------------------------------ Constructor
/**
* Construct <code>LogKitLogger</code> which wraps the <code>LogKit</code>
* logger with given name.
@@ -64,12 +58,10 @@ public class LogKitLogger implements Log, Serializable {
this.logger = getLogger();
}
// --------------------------------------------------------- Public Methods
/**
* <p>Return the underlying Logger we are using.</p>
* Return the underlying Logger we are using.
*/
public Logger getLogger() {
@@ -80,10 +72,8 @@ public class LogKitLogger implements Log, Serializable {
}
// ----------------------------------------------------- Log Implementation
/**
* Logs a message with <code>org.apache.log.Priority.DEBUG</code>.
*
@@ -94,7 +84,6 @@ public class LogKitLogger implements Log, Serializable {
debug(message);
}
/**
* Logs a message with <code>org.apache.log.Priority.DEBUG</code>.
*
@@ -106,7 +95,6 @@ public class LogKitLogger implements Log, Serializable {
debug(message, t);
}
/**
* Logs a message with <code>org.apache.log.Priority.DEBUG</code>.
*
@@ -119,7 +107,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.DEBUG</code>.
*
@@ -133,7 +120,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.INFO</code>.
*
@@ -146,7 +132,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.INFO</code>.
*
@@ -160,7 +145,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.WARN</code>.
*
@@ -173,7 +157,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.WARN</code>.
*
@@ -187,7 +170,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.ERROR</code>.
*
@@ -200,7 +182,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.ERROR</code>.
*
@@ -214,7 +195,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.FATAL_ERROR</code>.
*
@@ -227,7 +207,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Logs a message with <code>org.apache.log.Priority.FATAL_ERROR</code>.
*
@@ -241,7 +220,6 @@ public class LogKitLogger implements Log, Serializable {
}
}
/**
* Checks whether the <code>LogKit</code> logger will log messages of priority <code>DEBUG</code>.
*/
@@ -249,7 +227,6 @@ public class LogKitLogger implements Log, Serializable {
return getLogger().isDebugEnabled();
}
/**
* Checks whether the <code>LogKit</code> logger will log messages of priority <code>ERROR</code>.
*/
@@ -257,7 +234,6 @@ public class LogKitLogger implements Log, Serializable {
return getLogger().isErrorEnabled();
}
/**
* Checks whether the <code>LogKit</code> logger will log messages of priority <code>FATAL_ERROR</code>.
*/
@@ -265,7 +241,6 @@ public class LogKitLogger implements Log, Serializable {
return getLogger().isFatalErrorEnabled();
}
/**
* Checks whether the <code>LogKit</code> logger will log messages of priority <code>INFO</code>.
*/
@@ -273,7 +248,6 @@ public class LogKitLogger implements Log, Serializable {
return getLogger().isInfoEnabled();
}
/**
* Checks whether the <code>LogKit</code> logger will log messages of priority <code>DEBUG</code>.
*/
@@ -281,13 +255,10 @@ public class LogKitLogger implements Log, Serializable {
return getLogger().isDebugEnabled();
}
/**
* Checks whether the <code>LogKit</code> logger will log messages of priority <code>WARN</code>.
*/
public boolean isWarnEnabled() {
return getLogger().isWarnEnabled();
}
}

View File

@@ -15,17 +15,14 @@
* limitations under the License.
*/
package org.apache.commons.logging.impl;
import java.io.Serializable;
import org.apache.commons.logging.Log;
/**
* <p>Trivial implementation of Log that throws away all messages. No
* configurable system properties are supported.</p>
* Trivial implementation of Log that throws away all messages. No
* configurable system properties are supported.
*
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
* @author Rod Waldhoff
@@ -103,5 +100,4 @@ public class NoOpLog implements Log, Serializable {
* @return false
*/
public final boolean isWarnEnabled() { return false; }
}

View File

@@ -15,7 +15,6 @@
* limitations under the License.
*/
package org.apache.commons.logging.impl;
import java.lang.reflect.InvocationTargetException;
@@ -26,7 +25,6 @@ import javax.servlet.ServletContextListener;
import org.apache.commons.logging.LogFactory;
/**
* This class is capable of receiving notifications about the undeployment of
* a webapp, and responds by ensuring that commons-logging releases all

View File

@@ -15,7 +15,6 @@
* limitations under the License.
*/
package org.apache.commons.logging.impl;
import java.io.InputStream;
@@ -75,29 +74,29 @@ import org.apache.commons.logging.LogConfigurationException;
*/
public class SimpleLog implements Log, Serializable {
// ------------------------------------------------------- Class Attributes
/** All system properties used by <code>SimpleLog</code> start with this */
static protected final String systemPrefix =
"org.apache.commons.logging.simplelog.";
static protected final String systemPrefix = "org.apache.commons.logging.simplelog.";
/** Properties loaded from simplelog.properties */
static protected final Properties simpleLogProps = new Properties();
/** The default format to use when formating dates */
static protected final String DEFAULT_DATE_TIME_FORMAT =
"yyyy/MM/dd HH:mm:ss:SSS zzz";
static protected final String DEFAULT_DATE_TIME_FORMAT = "yyyy/MM/dd HH:mm:ss:SSS zzz";
/** Include the instance name in the log message? */
static protected boolean showLogName = false;
/** Include the short name ( last component ) of the logger in the log
* message. Defaults to true - otherwise we'll be lost in a flood of
* messages without knowing who sends them.
*/
static protected boolean showShortName = true;
/** Include the current time in the log message */
static protected boolean showDateTime = false;
/** The date and time format to use in the log message */
static protected String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
@@ -113,7 +112,6 @@ public class SimpleLog implements Log, Serializable {
// ---------------------------------------------------- Log Level Constants
/** "Trace" level logging. */
public static final int LOG_LEVEL_TRACE = 1;
/** "Debug" level logging. */
@@ -196,7 +194,6 @@ public class SimpleLog implements Log, Serializable {
/** The short name of this simple log instance */
private String shortLogName = null;
// ------------------------------------------------------------ Constructor
/**
@@ -246,7 +243,6 @@ public class SimpleLog implements Log, Serializable {
}
// -------------------------------------------------------- Properties
/**
@@ -260,23 +256,20 @@ public class SimpleLog implements Log, Serializable {
}
/**
* <p> Get logging level. </p>
* Get logging level.
*/
public int getLevel() {
return currentLogLevel;
}
// -------------------------------------------------------- Logging Methods
/**
* <p> Do the actual logging.
* This method assembles the message
* and then calls <code>write()</code> to cause it to be written.</p>
* Do the actual logging.
* <p>
* This method assembles the message and then calls <code>write()</code>
* to cause it to be written.
*
* @param type One of the LOG_LEVEL_XXX constants defining the log level
* @param message The message itself (typically a String)
@@ -337,10 +330,8 @@ public class SimpleLog implements Log, Serializable {
// Print to the appropriate destination
write(buf);
}
/**
* <p>Write the content of the message accumulated in the specified
* <code>StringBuffer</code> to the appropriate output destination. The
@@ -350,12 +341,9 @@ public class SimpleLog implements Log, Serializable {
* text to be logged
*/
protected void write(StringBuffer buffer) {
System.err.println(buffer.toString());
}
/**
* Is the given log level currently enabled?
*
@@ -367,10 +355,8 @@ public class SimpleLog implements Log, Serializable {
return logLevel >= currentLogLevel;
}
// -------------------------------------------------------- Log Implementation
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_DEBUG</code>.
@@ -379,13 +365,11 @@ public class SimpleLog implements Log, Serializable {
* @see org.apache.commons.logging.Log#debug(Object)
*/
public final void debug(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) {
log(SimpleLog.LOG_LEVEL_DEBUG, message, null);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_DEBUG</code>.
@@ -395,246 +379,202 @@ public class SimpleLog implements Log, Serializable {
* @see org.apache.commons.logging.Log#debug(Object, Throwable)
*/
public final void debug(Object message, Throwable t) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) {
log(SimpleLog.LOG_LEVEL_DEBUG, message, t);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_TRACE</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_TRACE</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#trace(Object)
*/
public final void trace(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
log(SimpleLog.LOG_LEVEL_TRACE, message, null);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_TRACE</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_TRACE</code>.
*
* @param message to log
* @param t log this cause
* @see org.apache.commons.logging.Log#trace(Object, Throwable)
*/
public final void trace(Object message, Throwable t) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
log(SimpleLog.LOG_LEVEL_TRACE, message, t);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_INFO</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_INFO</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#info(Object)
*/
public final void info(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
log(SimpleLog.LOG_LEVEL_INFO,message,null);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_INFO</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_INFO</code>.
*
* @param message to log
* @param t log this cause
* @see org.apache.commons.logging.Log#info(Object, Throwable)
*/
public final void info(Object message, Throwable t) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
log(SimpleLog.LOG_LEVEL_INFO, message, t);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_WARN</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_WARN</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#warn(Object)
*/
public final void warn(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
log(SimpleLog.LOG_LEVEL_WARN, message, null);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_WARN</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_WARN</code>.
*
* @param message to log
* @param t log this cause
* @see org.apache.commons.logging.Log#warn(Object, Throwable)
*/
public final void warn(Object message, Throwable t) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
log(SimpleLog.LOG_LEVEL_WARN, message, t);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_ERROR</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_ERROR</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#error(Object)
*/
public final void error(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) {
log(SimpleLog.LOG_LEVEL_ERROR, message, null);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_ERROR</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_ERROR</code>.
*
* @param message to log
* @param t log this cause
* @see org.apache.commons.logging.Log#error(Object, Throwable)
*/
public final void error(Object message, Throwable t) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) {
log(SimpleLog.LOG_LEVEL_ERROR, message, t);
}
}
/**
* Log a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_FATAL</code>.
* Log a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_FATAL</code>.
*
* @param message to log
* @see org.apache.commons.logging.Log#fatal(Object)
*/
public final void fatal(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) {
log(SimpleLog.LOG_LEVEL_FATAL, message, null);
}
}
/**
* Logs a message with
* <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_FATAL</code>.
* Logs a message with <code>org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_FATAL</code>.
*
* @param message to log
* @param t log this cause
* @see org.apache.commons.logging.Log#fatal(Object, Throwable)
*/
public final void fatal(Object message, Throwable t) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) {
log(SimpleLog.LOG_LEVEL_FATAL, message, t);
}
}
/**
* <p> Are debug messages currently enabled? </p>
*
* <p> This allows expensive operations such as <code>String</code>
* Are debug messages currently enabled?
* <p>
* This allows expensive operations such as <code>String</code>
* concatenation to be avoided when the message will be ignored by the
* logger. </p>
* logger.
*/
public final boolean isDebugEnabled() {
return isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG);
}
/**
* <p> Are error messages currently enabled? </p>
*
* <p> This allows expensive operations such as <code>String</code>
* Are error messages currently enabled?
* <p>
* This allows expensive operations such as <code>String</code>
* concatenation to be avoided when the message will be ignored by the
* logger. </p>
* logger.
*/
public final boolean isErrorEnabled() {
return isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR);
}
/**
* <p> Are fatal messages currently enabled? </p>
*
* <p> This allows expensive operations such as <code>String</code>
* Are fatal messages currently enabled?
* <p>
* This allows expensive operations such as <code>String</code>
* concatenation to be avoided when the message will be ignored by the
* logger. </p>
* logger.
*/
public final boolean isFatalEnabled() {
return isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL);
}
/**
* <p> Are info messages currently enabled? </p>
*
* <p> This allows expensive operations such as <code>String</code>
* Are info messages currently enabled?
* <p>
* This allows expensive operations such as <code>String</code>
* concatenation to be avoided when the message will be ignored by the
* logger. </p>
* logger.
*/
public final boolean isInfoEnabled() {
return isLevelEnabled(SimpleLog.LOG_LEVEL_INFO);
}
/**
* <p> Are trace messages currently enabled? </p>
*
* <p> This allows expensive operations such as <code>String</code>
* Are trace messages currently enabled?
* <p>
* This allows expensive operations such as <code>String</code>
* concatenation to be avoided when the message will be ignored by the
* logger. </p>
* logger.
*/
public final boolean isTraceEnabled() {
return isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE);
}
/**
* <p> Are warn messages currently enabled? </p>
*
* <p> This allows expensive operations such as <code>String</code>
* Are warn messages currently enabled?
* <p>
* This allows expensive operations such as <code>String</code>
* concatenation to be avoided when the message will be ignored by the
* logger. </p>
* logger.
*/
public final boolean isWarnEnabled() {
return isLevelEnabled(SimpleLog.LOG_LEVEL_WARN);
}
/**
* Return the thread context class loader if available.
* Otherwise return null.
@@ -645,8 +585,7 @@ public class SimpleLog implements Log, Serializable {
* @exception LogConfigurationException if a suitable class loader
* cannot be identified.
*/
private static ClassLoader getContextClassLoader()
{
private static ClassLoader getContextClassLoader() {
ClassLoader classLoader = null;
try {
@@ -699,8 +638,7 @@ public class SimpleLog implements Log, Serializable {
return classLoader;
}
private static InputStream getResourceAsStream(final String name)
{
private static InputStream getResourceAsStream(final String name) {
return (InputStream)AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {