public class Logger
extends java.lang.Object
implements java.io.Serializable
Only exposes the relevent factory and logging methods.
For JBoss the logging should be done as follows:
isTraceEnabled()
,
trace(Object)
,
trace(Object,Throwable)
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected static java.lang.String |
DEFAULT_PLUGIN_CLASS_NAME
The default LoggerPlugin implementation is log4j
|
protected LoggerPlugin |
loggerDelegate
The logger plugin delegate
|
protected static java.lang.String |
PLUGIN_CLASS_PROP
The system property to look for an externalized LoggerPlugin implementation class
|
protected static java.lang.Class |
pluginClass
The LoggerPlugin implementation class to use
|
protected static java.lang.String |
pluginClassName
The class name of the LoggerPlugin implementation class to use
|
Modifier | Constructor and Description |
---|---|
protected |
Logger(java.lang.String name)
Creates new Logger the given logger name.
|
Modifier and Type | Method and Description |
---|---|
void |
debug(java.lang.Object message)
Issue a log msg with a level of DEBUG.
|
void |
debug(java.lang.Object message,
java.lang.Throwable t)
Issue a log msg and throwable with a level of DEBUG.
|
void |
error(java.lang.Object message)
Issue a log msg with a level of ERROR.
|
void |
error(java.lang.Object message,
java.lang.Throwable t)
Issue a log msg and throwable with a level of ERROR.
|
void |
fatal(java.lang.Object message)
Issue a log msg with a level of FATAL.
|
void |
fatal(java.lang.Object message,
java.lang.Throwable t)
Issue a log msg and throwable with a level of FATAL.
|
protected static LoggerPlugin |
getDelegatePlugin(java.lang.String name)
Get the delegate plugin
|
static Logger |
getLogger(java.lang.Class clazz)
Create a Logger instance given the logger class.
|
static Logger |
getLogger(java.lang.Class clazz,
java.lang.String suffix)
Create a Logger instance given the logger class with the given suffix.
|
static Logger |
getLogger(java.lang.String name)
Create a Logger instance given the logger name.
|
static Logger |
getLogger(java.lang.String name,
java.lang.String suffix)
Create a Logger instance given the logger name with the given suffix.
|
LoggerPlugin |
getLoggerPlugin()
Get the logger plugin delegate
|
java.lang.String |
getName()
Return the name of this logger.
|
static java.lang.String |
getPluginClassName()
The LoggerPlugin implementation class name in use
|
void |
info(java.lang.Object message)
Issue a log msg with a level of INFO.
|
void |
info(java.lang.Object message,
java.lang.Throwable t)
Issue a log msg and throwable with a level of INFO.
|
protected static void |
init()
Initialize the LoggerPlugin class to use as the delegate to the
logging system.
|
boolean |
isDebugEnabled()
Deprecated.
DEBUG is for low volume logging, you don't need this
|
boolean |
isInfoEnabled()
Deprecated.
INFO is for low volume information, you don't need this
|
boolean |
isTraceEnabled()
Check to see if the TRACE level is enabled for this logger.
|
static void |
setPluginClassName(java.lang.String pluginClassName)
Set the LoggerPlugin implementation class name in use
|
void |
trace(java.lang.Object message)
Issue a log msg with a level of TRACE.
|
void |
trace(java.lang.Object message,
java.lang.Throwable t)
Issue a log msg and throwable with a level of TRACE.
|
void |
warn(java.lang.Object message)
Issue a log msg with a level of WARN.
|
void |
warn(java.lang.Object message,
java.lang.Throwable t)
Issue a log msg and throwable with a level of WARN.
|
protected static java.lang.String PLUGIN_CLASS_PROP
protected static final java.lang.String DEFAULT_PLUGIN_CLASS_NAME
protected static java.lang.Class pluginClass
protected static java.lang.String pluginClassName
protected transient LoggerPlugin loggerDelegate
protected Logger(java.lang.String name)
name
- the logger name.public static java.lang.String getPluginClassName()
public static void setPluginClassName(java.lang.String pluginClassName)
pluginClassName
- the LoggerPlugin implementation class namepublic java.lang.String getName()
public LoggerPlugin getLoggerPlugin()
public boolean isTraceEnabled()
trace(Object)
method invocation would pass
the msg to the configured appenders, false otherwise.public void trace(java.lang.Object message)
message
- the messagepublic void trace(java.lang.Object message, java.lang.Throwable t)
message
- the messaget
- the throwablepublic boolean isDebugEnabled()
trace(Object)
method invocation would pass
the msg to the configured appenders, false otherwise.public void debug(java.lang.Object message)
message
- the messagepublic void debug(java.lang.Object message, java.lang.Throwable t)
message
- the messaget
- the throwablepublic boolean isInfoEnabled()
info(Object)
method invocation would pass
the msg to the configured appenders, false otherwise.public void info(java.lang.Object message)
message
- the messagepublic void info(java.lang.Object message, java.lang.Throwable t)
message
- the messaget
- the throwablepublic void warn(java.lang.Object message)
message
- the messagepublic void warn(java.lang.Object message, java.lang.Throwable t)
message
- the messaget
- the throwablepublic void error(java.lang.Object message)
message
- the messagepublic void error(java.lang.Object message, java.lang.Throwable t)
message
- the messaget
- the throwablepublic void fatal(java.lang.Object message)
message
- the messagepublic void fatal(java.lang.Object message, java.lang.Throwable t)
message
- the messaget
- the throwablepublic static Logger getLogger(java.lang.String name)
name
- the logger namepublic static Logger getLogger(java.lang.String name, java.lang.String suffix)
This will include a logger seperator between classname and suffix
name
- the logger namesuffix
- a suffix to append to the classname.public static Logger getLogger(java.lang.Class clazz)
clazz
- the Class whose name will be used as the logger namepublic static Logger getLogger(java.lang.Class clazz, java.lang.String suffix)
This will include a logger seperator between classname and suffix
clazz
- the Class whose name will be used as the logger name.suffix
- a suffix to append to the classname.protected static LoggerPlugin getDelegatePlugin(java.lang.String name)
name
- the name of the loggerprotected static void init()
setPluginClassName(String)
method,
then the PLUGIN_CLASS_PROP system property and finally the
LOG4J_PLUGIN_CLASS_NAME default. If the LoggerPlugin implementation
class cannot be loaded the default NullLoggerPlugin will be used.