Package org.apache.commons.logging.impl
Class Jdk13LumberjackLogger
- java.lang.Object
-
- org.apache.commons.logging.impl.Jdk13LumberjackLogger
-
- All Implemented Interfaces:
java.io.Serializable,Log
public class Jdk13LumberjackLogger extends java.lang.Object implements Log, java.io.Serializable
Implementation of theorg.apache.commons.logging.Loginterface that wraps the standard JDK logging mechanisms that are available in SourceForge's Lumberjack for JDKs prior to 1.4.- Since:
- 1.1
- Version:
- $Id: Jdk13LumberjackLogger.java 1432663 2013-01-13 17:24:18Z tn $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleanclassAndMethodFoundprotected static java.util.logging.LeveldummyLevelThis member variable simply ensures that any attempt to initialise this class in a pre-1.4 JVM will result in an ExceptionInInitializerError.protected java.util.logging.LoggerloggerThe underlying Logger implementation we are using.protected java.lang.Stringnameprivate static longserialVersionUIDSerializable version identifier.private java.lang.StringsourceClassNameprivate java.lang.StringsourceMethodName
-
Constructor Summary
Constructors Constructor Description Jdk13LumberjackLogger(java.lang.String name)Construct a named instance of this Logger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(java.lang.Object message)Logs a message withjava.util.logging.Level.FINE.voiddebug(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.FINE.voiderror(java.lang.Object message)Logs a message withjava.util.logging.Level.SEVERE.voiderror(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.SEVERE.voidfatal(java.lang.Object message)Logs a message withjava.util.logging.Level.SEVERE.voidfatal(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.SEVERE.private voidgetClassAndMethod()Gets the class and method by looking at the stack trace for the first entry that is not this class.java.util.logging.LoggergetLogger()Return the native Logger instance we are using.voidinfo(java.lang.Object message)Logs a message withjava.util.logging.Level.INFO.voidinfo(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.INFO.booleanisDebugEnabled()Is debug logging currently enabled?booleanisErrorEnabled()Is error logging currently enabled?booleanisFatalEnabled()Is fatal logging currently enabled?booleanisInfoEnabled()Is info logging currently enabled?booleanisTraceEnabled()Is trace logging currently enabled?booleanisWarnEnabled()Is warn logging currently enabled?private voidlog(java.util.logging.Level level, java.lang.String msg, java.lang.Throwable ex)voidtrace(java.lang.Object message)Logs a message withjava.util.logging.Level.FINEST.voidtrace(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.FINEST.voidwarn(java.lang.Object message)Logs a message withjava.util.logging.Level.WARNING.voidwarn(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.WARNING.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serializable version identifier.- See Also:
- Constant Field Values
-
logger
protected transient java.util.logging.Logger logger
The underlying Logger implementation we are using.
-
name
protected java.lang.String name
-
sourceClassName
private java.lang.String sourceClassName
-
sourceMethodName
private java.lang.String sourceMethodName
-
classAndMethodFound
private boolean classAndMethodFound
-
dummyLevel
protected static final java.util.logging.Level dummyLevel
This member variable simply ensures that any attempt to initialise this class in a pre-1.4 JVM will result in an ExceptionInInitializerError. It must not be private, as an optimising compiler could detect that it is not used and optimise it away.
-
-
Method Detail
-
log
private void log(java.util.logging.Level level, java.lang.String msg, java.lang.Throwable ex)
-
getClassAndMethod
private void getClassAndMethod()
Gets the class and method by looking at the stack trace for the first entry that is not this class.
-
debug
public void debug(java.lang.Object message)
Logs a message withjava.util.logging.Level.FINE.- Specified by:
debugin interfaceLog- Parameters:
message- to log- See Also:
Log.debug(Object)
-
debug
public void debug(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.FINE.- Specified by:
debugin interfaceLog- Parameters:
message- to logexception- log this cause- See Also:
Log.debug(Object, Throwable)
-
error
public void error(java.lang.Object message)
Logs a message withjava.util.logging.Level.SEVERE.- Specified by:
errorin interfaceLog- Parameters:
message- to log- See Also:
Log.error(Object)
-
error
public void error(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.SEVERE.- Specified by:
errorin interfaceLog- Parameters:
message- to logexception- log this cause- See Also:
Log.error(Object, Throwable)
-
fatal
public void fatal(java.lang.Object message)
Logs a message withjava.util.logging.Level.SEVERE.- Specified by:
fatalin interfaceLog- Parameters:
message- to log- See Also:
Log.fatal(Object)
-
fatal
public void fatal(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.SEVERE.- Specified by:
fatalin interfaceLog- Parameters:
message- to logexception- log this cause- See Also:
Log.fatal(Object, Throwable)
-
getLogger
public java.util.logging.Logger getLogger()
Return the native Logger instance we are using.
-
info
public void info(java.lang.Object message)
Logs a message withjava.util.logging.Level.INFO.- Specified by:
infoin interfaceLog- Parameters:
message- to log- See Also:
Log.info(Object)
-
info
public void info(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.INFO.- Specified by:
infoin interfaceLog- Parameters:
message- to logexception- log this cause- See Also:
Log.info(Object, Throwable)
-
isDebugEnabled
public boolean isDebugEnabled()
Is debug logging currently enabled?- Specified by:
isDebugEnabledin interfaceLog- Returns:
- true if debug is enabled in the underlying logger.
-
isErrorEnabled
public boolean isErrorEnabled()
Is error logging currently enabled?- Specified by:
isErrorEnabledin interfaceLog- Returns:
- true if error is enabled in the underlying logger.
-
isFatalEnabled
public boolean isFatalEnabled()
Is fatal logging currently enabled?- Specified by:
isFatalEnabledin interfaceLog- Returns:
- true if fatal is enabled in the underlying logger.
-
isInfoEnabled
public boolean isInfoEnabled()
Is info logging currently enabled?- Specified by:
isInfoEnabledin interfaceLog- Returns:
- true if info is enabled in the underlying logger.
-
isTraceEnabled
public boolean isTraceEnabled()
Is trace logging currently enabled?- Specified by:
isTraceEnabledin interfaceLog- Returns:
- true if trace is enabled in the underlying logger.
-
isWarnEnabled
public boolean isWarnEnabled()
Is warn logging currently enabled?- Specified by:
isWarnEnabledin interfaceLog- Returns:
- true if warn is enabled in the underlying logger.
-
trace
public void trace(java.lang.Object message)
Logs a message withjava.util.logging.Level.FINEST.- Specified by:
tracein interfaceLog- Parameters:
message- to log- See Also:
Log.trace(Object)
-
trace
public void trace(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.FINEST.- Specified by:
tracein interfaceLog- Parameters:
message- to logexception- log this cause- See Also:
Log.trace(Object, Throwable)
-
warn
public void warn(java.lang.Object message)
Logs a message withjava.util.logging.Level.WARNING.- Specified by:
warnin interfaceLog- Parameters:
message- to log- See Also:
Log.warn(Object)
-
warn
public void warn(java.lang.Object message, java.lang.Throwable exception)Logs a message withjava.util.logging.Level.WARNING.- Specified by:
warnin interfaceLog- Parameters:
message- to logexception- log this cause- See Also:
Log.warn(Object, Throwable)
-
-