|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.logging.Logger
public class Logger
Logger wrapper that tries to dynamically load a log4j class to determine if log4j is available in the VM. If it is the case, a log4j delegate is built and used. In the contrary, a null logger is used. This class cannot directly reference log4j classes otherwise the JVM will try to load it and make it fail. To set
Only exposes the relevent factory and logging methods.
For JBoss the logging should be done as follows:
isTraceEnabled()
,
trace(Object)
,
trace(Object,Throwable)
,
Serialized FormField Summary | |
---|---|
protected static String |
LOG4J_PLUGIN_CLASS_NAME
The default LoggerPlugin implementation is log4j |
protected LoggerPlugin |
loggerDelegate
The logger plugin delegate |
protected static String |
PLUGIN_CLASS_PROP
The system property to look for an externalized LoggerPlugin implementation class |
protected static Class<?> |
pluginClass
The LoggerPlugin implementation class to use |
protected static String |
pluginClassName
The class name of the LoggerPlugin implementation class to use |
Constructor Summary | |
---|---|
protected |
Logger(String name)
Creates new Logger the given logger name. |
Method Summary | |
---|---|
void |
debug(Object message)
Issue a log msg with a level of DEBUG. |
void |
debug(Object message,
Throwable t)
Issue a log msg and throwable with a level of DEBUG. |
void |
debug(String loggerFqcn,
Object message,
Throwable t)
Issue a log msg and throwable with a level of DEBUG and a specific logger class name. |
void |
debugf(String format,
Object... params)
Issue a formatted log message with a level of DEBUG. |
void |
debugf(Throwable t,
String format,
Object... params)
Issue a formatted log message with a level of DEBUG. |
void |
error(Object message)
Issue a log msg with a level of ERROR. |
void |
error(Object message,
Throwable t)
Issue a log msg and throwable with a level of ERROR. |
void |
error(String loggerFqcn,
Object message,
Throwable t)
Issue a log msg and throwable with a level of ERROR and a specific logger class name. |
void |
errorf(String format,
Object... params)
Issue a formatted log message with a level of ERROR. |
void |
errorf(Throwable t,
String format,
Object... params)
Issue a formatted log message with a level of ERROR. |
void |
fatal(Object message)
Issue a log msg with a level of FATAL. |
void |
fatal(Object message,
Throwable t)
Issue a log msg and throwable with a level of FATAL. |
void |
fatal(String loggerFqcn,
Object message,
Throwable t)
Issue a log msg and throwable with a level of FATAL and a specific logger class name. |
void |
fatalf(String format,
Object... params)
Issue a formatted log message with a level of FATAL. |
void |
fatalf(Throwable t,
String format,
Object... params)
Issue a formatted log message with a level of FATAL. |
protected static LoggerPlugin |
getDelegatePlugin(String name)
Get the delegate plugin |
static Logger |
getLogger(Class<?> clazz)
Create a Logger instance given the logger class. |
static Logger |
getLogger(Class<?> clazz,
String suffix)
Create a Logger instance given the logger class with the given suffix. |
static Logger |
getLogger(String name)
Create a Logger instance given the logger name. |
static Logger |
getLogger(String name,
String suffix)
Create a Logger instance given the logger name with the given suffix. |
LoggerPlugin |
getLoggerPlugin()
Get the logger plugin delegate |
String |
getName()
Return the name of this logger. |
static String |
getPluginClassName()
The LoggerPlugin implementation class name in use |
void |
info(Object message)
Issue a log msg with a level of INFO. |
void |
info(Object message,
Throwable t)
Issue a log msg and throwable with a level of INFO. |
void |
info(String loggerFqcn,
Object message,
Throwable t)
Issue a log msg and throwable with a level of INFO and a specific logger class name. |
void |
infof(String format,
Object... params)
Issue a formatted log message with a level of INFO. |
void |
infof(Throwable t,
String format,
Object... params)
Issue a formatted log message 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(String pluginClassName)
Set the LoggerPlugin implementation class name in use |
void |
trace(Object message)
Issue a log msg with a level of TRACE. |
void |
trace(Object message,
Throwable t)
Issue a log msg and throwable with a level of TRACE. |
void |
trace(String loggerFqcn,
Object message,
Throwable t)
Issue a log msg and throwable with a level of TRACE and a specific logger class name. |
void |
tracef(String format,
Object... params)
Issue a formatted log message with a level of TRACE. |
void |
tracef(Throwable t,
String format,
Object... params)
Issue a formatted log message with a level of TRACE. |
void |
warn(Object message)
Issue a log msg with a level of WARN. |
void |
warn(Object message,
Throwable t)
Issue a log msg and throwable with a level of WARN. |
void |
warn(String loggerFqcn,
Object message,
Throwable t)
Issue a log msg and throwable with a level of WARN and a specific logger class name. |
void |
warnf(String format,
Object... params)
Issue a formatted log message with a level of WARN. |
void |
warnf(Throwable t,
String format,
Object... params)
Issue a formatted log message with a level of WARN. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static String PLUGIN_CLASS_PROP
protected static final String LOG4J_PLUGIN_CLASS_NAME
protected static Class<?> pluginClass
protected static String pluginClassName
protected transient LoggerPlugin loggerDelegate
Constructor Detail |
---|
protected Logger(String name)
name
- the logger name.Method Detail |
---|
public static String getPluginClassName()
public static void setPluginClassName(String pluginClassName)
pluginClassName
- the LoggerPlugin implementation class namepublic 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(Object message)
message
- the messagepublic void trace(Object message, Throwable t)
message
- the messaget
- the throwablepublic void trace(String loggerFqcn, Object message, Throwable t)
loggerFqcn
- the logger class namemessage
- the messaget
- the throwablepublic void tracef(String format, Object... params)
format
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void tracef(Throwable t, String format, Object... params)
t
- the throwableformat
- the format string, as per String.format(String, Object[])
params
- the parameterspublic boolean isDebugEnabled()
trace(Object)
method invocation would pass
the msg to the configured appenders, false otherwise.public void debug(Object message)
message
- the messagepublic void debug(Object message, Throwable t)
message
- the messaget
- the throwablepublic void debug(String loggerFqcn, Object message, Throwable t)
loggerFqcn
- the logger class namemessage
- the messaget
- the throwablepublic void debugf(String format, Object... params)
format
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void debugf(Throwable t, String format, Object... params)
t
- the throwableformat
- the format string, as per String.format(String, Object[])
params
- the parameterspublic boolean isInfoEnabled()
info(Object)
method invocation would pass
the msg to the configured appenders, false otherwise.public void info(Object message)
message
- the messagepublic void info(Object message, Throwable t)
message
- the messaget
- the throwablepublic void info(String loggerFqcn, Object message, Throwable t)
loggerFqcn
- the logger class namemessage
- the messaget
- the throwablepublic void infof(String format, Object... params)
format
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void infof(Throwable t, String format, Object... params)
t
- the throwableformat
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void warn(Object message)
message
- the messagepublic void warn(Object message, Throwable t)
message
- the messaget
- the throwablepublic void warn(String loggerFqcn, Object message, Throwable t)
loggerFqcn
- the logger class namemessage
- the messaget
- the throwablepublic void warnf(String format, Object... params)
format
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void warnf(Throwable t, String format, Object... params)
t
- the throwableformat
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void error(Object message)
message
- the messagepublic void error(Object message, Throwable t)
message
- the messaget
- the throwablepublic void error(String loggerFqcn, Object message, Throwable t)
loggerFqcn
- the logger class namemessage
- the messaget
- the throwablepublic void errorf(String format, Object... params)
format
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void errorf(Throwable t, String format, Object... params)
t
- the throwableformat
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void fatal(Object message)
message
- the messagepublic void fatal(Object message, Throwable t)
message
- the messaget
- the throwablepublic void fatal(String loggerFqcn, Object message, Throwable t)
loggerFqcn
- the logger class namemessage
- the messaget
- the throwablepublic void fatalf(String format, Object... params)
format
- the format string, as per String.format(String, Object[])
params
- the parameterspublic void fatalf(Throwable t, String format, Object... params)
t
- the throwableformat
- the format string, as per String.format(String, Object[])
params
- the parameterspublic static Logger getLogger(String name)
name
- the logger name
public static Logger getLogger(String name, 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(Class<?> clazz)
clazz
- the Class whose name will be used as the logger name
public static Logger getLogger(Class<?> clazz, 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(String name)
name
- the name of the logger
protected 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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |