public class CommandLineLogger
extends java.lang.Object
implements org.apache.commons.logging.Log
Modifier and Type | Field and Description |
---|---|
static int |
LOG_LEVEL_DEBUG
"Debug" level logging.
|
static int |
LOG_LEVEL_ERROR
"Error" level logging.
|
static int |
LOG_LEVEL_FATAL
"Fatal" level logging.
|
static int |
LOG_LEVEL_INFO
"Info" level logging.
|
static int |
LOG_LEVEL_TRACE
"Trace" level logging.
|
static int |
LOG_LEVEL_WARN
"Warn" level logging.
|
Constructor and Description |
---|
CommandLineLogger(java.lang.String logName)
Construct the logger with a default log level taken from the LogFactory
attribute "level".
|
Modifier and Type | Method and Description |
---|---|
void |
debug(java.lang.Object message) |
void |
debug(java.lang.Object message,
java.lang.Throwable t) |
void |
error(java.lang.Object message) |
void |
error(java.lang.Object message,
java.lang.Throwable t) |
void |
fatal(java.lang.Object message) |
void |
fatal(java.lang.Object message,
java.lang.Throwable t) |
void |
info(java.lang.Object message) |
void |
info(java.lang.Object message,
java.lang.Throwable t) |
boolean |
isDebugEnabled() |
boolean |
isErrorEnabled() |
boolean |
isFatalEnabled() |
boolean |
isInfoEnabled() |
boolean |
isTraceEnabled() |
boolean |
isWarnEnabled() |
protected void |
log(int type,
java.lang.Object message,
java.lang.Throwable t)
Do the actual logging.
|
void |
setLogLevel(java.lang.String level)
Set a log level for the logger.
|
void |
trace(java.lang.Object message) |
void |
trace(java.lang.Object message,
java.lang.Throwable t) |
void |
warn(java.lang.Object message) |
void |
warn(java.lang.Object message,
java.lang.Throwable t) |
public static final int LOG_LEVEL_TRACE
public static final int LOG_LEVEL_DEBUG
public static final int LOG_LEVEL_INFO
public static final int LOG_LEVEL_WARN
public static final int LOG_LEVEL_ERROR
public static final int LOG_LEVEL_FATAL
public CommandLineLogger(java.lang.String logName)
logName
- the logger name.public void setLogLevel(java.lang.String level)
level
- the log levelpublic final boolean isTraceEnabled()
isTraceEnabled
in interface org.apache.commons.logging.Log
public final boolean isDebugEnabled()
isDebugEnabled
in interface org.apache.commons.logging.Log
public final boolean isInfoEnabled()
isInfoEnabled
in interface org.apache.commons.logging.Log
public final boolean isWarnEnabled()
isWarnEnabled
in interface org.apache.commons.logging.Log
public final boolean isErrorEnabled()
isErrorEnabled
in interface org.apache.commons.logging.Log
public final boolean isFatalEnabled()
isFatalEnabled
in interface org.apache.commons.logging.Log
public final void trace(java.lang.Object message)
trace
in interface org.apache.commons.logging.Log
public final void trace(java.lang.Object message, java.lang.Throwable t)
trace
in interface org.apache.commons.logging.Log
public final void debug(java.lang.Object message)
debug
in interface org.apache.commons.logging.Log
public final void debug(java.lang.Object message, java.lang.Throwable t)
debug
in interface org.apache.commons.logging.Log
public final void info(java.lang.Object message)
info
in interface org.apache.commons.logging.Log
public final void info(java.lang.Object message, java.lang.Throwable t)
info
in interface org.apache.commons.logging.Log
public final void warn(java.lang.Object message)
warn
in interface org.apache.commons.logging.Log
public final void warn(java.lang.Object message, java.lang.Throwable t)
warn
in interface org.apache.commons.logging.Log
public final void error(java.lang.Object message)
error
in interface org.apache.commons.logging.Log
public final void error(java.lang.Object message, java.lang.Throwable t)
error
in interface org.apache.commons.logging.Log
public final void fatal(java.lang.Object message)
fatal
in interface org.apache.commons.logging.Log
public final void fatal(java.lang.Object message, java.lang.Throwable t)
fatal
in interface org.apache.commons.logging.Log
protected void log(int type, java.lang.Object message, java.lang.Throwable t)
write()
to cause it to be written.type
- One of the LOG_LEVEL_XXX constants defining the log levelmessage
- The message itself (typically a String)t
- The exception whose stack trace should be loggedCopyright 1999-2010 The Apache Software Foundation. All Rights Reserved.