public class Logger extends Category
NOTE: This is NOT the original file of Log4J Logger, and is only here to provide a static mapping to the Pax Logging system running under OSGi.
The client code that wishes to use this adaptation of Log4J and have the log output to be directed to the Pax Logging Service backend, which is driven by the real Log4J, it is necessary to;
m_delegate
Modifier and Type | Method and Description |
---|---|
void |
debug(Object message)
Log a message object with the DEBUG level.
|
void |
debug(Object messagePattern,
Object arg)
Log a message with the
DEBUG level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
debug(Object message,
Throwable t)
Log a message object with the
DEBUG level including the
stack trace of the Throwable t passed as parameter. |
void |
debug(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
DEBUG level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
static void |
dispose()
Pax Logging internal method.
|
void |
error(Object message)
Log a message object with the ERROR Level.
|
void |
error(Object messagePattern,
Object arg)
Log a message with the
ERROR level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
error(Object message,
Throwable t)
Log a message object with the
ERROR level including the
stack trace of the Throwable t passed as parameter. |
void |
error(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
ERROR level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
void |
fatal(Object message)
Log a message object with the FATAL Level.
|
void |
fatal(Object messagePattern,
Object arg)
Log a message with the
FATAL level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
fatal(Object message,
Throwable t)
Log a message object with the
FATAL level including the
stack trace of the Throwable t passed as parameter. |
void |
fatal(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
FATAL level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
static Logger |
getLogger(Class clazz)
Shorthand for
. |
static Logger |
getLogger(String name)
Retrieve a logger by name.
|
static Logger |
getLogger(String name,
LoggerFactory factory)
This method is equivalent to
getLogger( String name ) and the
LoggerFactory is ignored. |
static Logger |
getRootLogger()
Return the root of logger for the current hierarchy.
|
void |
info(Object message)
Log a message object with the INFO Level.
|
void |
info(Object messagePattern,
Object arg)
Log a message with the
INFO level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
info(Object message,
Throwable t)
Log a message object with the
INFO level including the stack
trace of the Throwable t passed as parameter. |
void |
info(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
INFO level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
boolean |
isErrorEnabled()
Check whether this category is enabled for the ERROR Level.
|
boolean |
isTraceEnabled()
Check whether this category is enabled for the TRACE Level.
|
boolean |
isWarnEnabled()
Check whether this category is enabled for the WARN Level.
|
static void |
release()
Lifecycle method to release any resources held.
|
static void |
setBundleContext(org.osgi.framework.BundleContext ctx) |
void |
trace(Object message)
Log a message object with the TRACE level.
|
void |
trace(Object messagePattern,
Object arg)
Log a message with the
TRACE level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
trace(Object message,
Throwable t)
Log a message object with the
TRACE level including the
stack trace of the Throwable t passed as parameter. |
void |
trace(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
TRACE level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
void |
warn(Object message)
Log a message object with the WARN Level.
|
void |
warn(Object messagePattern,
Object arg)
Log a message with the
WARN level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
warn(Object message,
Throwable t)
|
void |
warn(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
WARN level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
assertLog, getInstance, getInstance, getName, isDebugEnabled, isEnabledFor, isInfoEnabled, log, log, log, shutdown
public static void setBundleContext(org.osgi.framework.BundleContext ctx)
public static void release()
public static Logger getLogger(String name)
By default, loggers do not have a set level but inherit it from their ancestors. This is one of the central features of log4j.
name
- The name of the logger to retrieve.public static Logger getLogger(Class clazz)
getLogger(clazz.getName())
.clazz
- The name of clazz
will be used as the name of
the logger to retrieve. See getLogger(String)
for
more detailed information.public static Logger getRootLogger()
The root logger is always instantiated and available. It's name is "root".
Nevertheless, note that calling Logger.getLogger("root")
does not retrieve the root logger but a logger just under root named
"root".
public static Logger getLogger(String name, LoggerFactory factory)
getLogger( String name )
and the
LoggerFactory is ignored. The method exists only to improve compatibility with
Log4J.name
- The name of the logger to retrieve.factory
- Ignored!public void trace(Object message)
message
- the message object to log.for an explanation of the logic applied.
public void trace(Object message, Throwable t)
TRACE
level including the
stack trace of the Throwable
t
passed as parameter.
See debug(Object)
form for more detailed information.
public void trace(Object messagePattern, Object arg)
TRACE
level with message formatting
done according to the value of messagePattern
and
arg
parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg
- The argument to replace the formatting element, i,e,
the '{}' pair within messagePattern
.public void trace(String messagePattern, Object arg1, Object arg2)
TRACE
level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementpublic void fatal(String messagePattern, Object arg1, Object arg2)
FATAL
level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementpublic void debug(Object messagePattern, Object arg)
DEBUG
level with message formatting
done according to the value of messagePattern
and
arg
parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg
- The argument to replace the formatting element, i,e,
the '{}' pair within messagePattern
.public void debug(String messagePattern, Object arg1, Object arg2)
DEBUG
level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementpublic boolean isErrorEnabled()
Category.isDebugEnabled()
.true
if this category is enabled for level
ERROR, false
otherwise.public void error(Object messagePattern, Object arg)
ERROR
level with message formatting
done according to the value of messagePattern
and
arg
parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg
- The argument to replace the formatting element, i,e,
the '{}' pair within messagePattern
.public void error(String messagePattern, Object arg1, Object arg2)
ERROR
level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementpublic void fatal(Object messagePattern, Object arg)
FATAL
level with message formatting
done according to the value of messagePattern
and
arg
parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg
- The argument to replace the formatting element, i,e,
the '{}' pair within messagePattern
.public void info(Object messagePattern, Object arg)
INFO
level with message formatting
done according to the value of messagePattern
and
arg
parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg
- The argument to replace the formatting element, i,e,
the '{}' pair within messagePattern
.public void info(String messagePattern, Object arg1, Object arg2)
INFO
level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementpublic boolean isTraceEnabled()
Category.isDebugEnabled()
.true
if this category is enabled for level
TRACE, false
otherwise.public boolean isWarnEnabled()
Category.isDebugEnabled()
.true
if this category is enabled for level
WARN, false
otherwise.public void warn(Object messagePattern, Object arg)
WARN
level with message formatting
done according to the value of messagePattern
and
arg
parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg
- The argument to replace the formatting element, i,e,
the '{}' pair within messagePattern
.public void warn(String messagePattern, Object arg1, Object arg2)
WARN
level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementpublic void debug(Object message)
Category
This method first checks if this category is DEBUG
enabled
by comparing the level of this category with the
DEBUG level. If this category is DEBUG
enabled, then it
converts the message object (passed as parameter) to a string by
invoking the appropriate org.apache.log4j.or.ObjectRenderer. It
then proceeds to call all the registered appenders in this category and
also higher in the hierarchy depending on the value of the additivity
flag.
WARNING Note that passing a Throwable
to this method will
print the name of the Throwable
but no stack trace. To
print a stack trace use the Category.debug(Object,Throwable)
form
instead.
public void debug(Object message, Throwable t)
Category
DEBUG
level including the
stack trace of the Throwable
t
passed as parameter.
See Category.debug(Object)
form for more detailed information.
public void error(Object message)
Category
This method first checks if this category is ERROR
enabled
by comparing the level of this category with ERROR
Level. If this category is ERROR
enabled, then it converts
the message object passed as parameter to a string by invoking the
appropriate org.apache.log4j.or.ObjectRenderer. It proceeds to
call all the registered appenders in this category and also higher in
the hierarchy depending on the value of the additivity flag.
WARNING Note that passing a Throwable
to this method will
print the name of the Throwable
but no stack trace. To
print a stack trace use the Category.error(Object,Throwable)
form
instead.
public void error(Object message, Throwable t)
Category
ERROR
level including the
stack trace of the Throwable
t
passed as parameter.
See Category.error(Object)
form for more detailed information.
public void fatal(Object message)
Category
This method first checks if this category is FATAL
enabled
by comparing the level of this category with FATAL
Level. If the category is FATAL
enabled, then it converts
the message object passed as parameter to a string by invoking the
appropriate org.apache.log4j.or.ObjectRenderer. It proceeds to
call all the registered appenders in this category and also higher in
the hierarchy depending on the value of the additivity flag.
WARNING Note that passing a Throwable
to this method will
print the name of the Throwable but no stack trace. To print a stack
trace use the Category.fatal(Object,Throwable)
form instead.
public void fatal(Object message, Throwable t)
Category
FATAL
level including the
stack trace of the Throwable
t
passed as parameter.
See Category.fatal(Object)
for more detailed information.
public void info(Object message)
Category
This method first checks if this category is INFO
enabled by
comparing the level of this category with INFO Level.
If the category is INFO
enabled, then it converts the
message object passed as parameter to a string by invoking the
appropriate org.apache.log4j.or.ObjectRenderer. It proceeds to
call all the registered appenders in this category and also higher in
the hierarchy depending on the value of the additivity flag.
WARNING Note that passing a Throwable
to this method will
print the name of the Throwable but no stack trace. To print a stack
trace use the Category.info(Object,Throwable)
form instead.
public void info(Object message, Throwable t)
Category
INFO
level including the stack
trace of the Throwable
t
passed as parameter.
See Category.info(Object)
for more detailed information.
public void warn(Object message)
Category
This method first checks if this category is WARN
enabled by
comparing the level of this category with WARN Level.
If the category is WARN
enabled, then it converts the
message object passed as parameter to a string by invoking the
appropriate org.apache.log4j.or.ObjectRenderer. It proceeds to
call all the registered appenders in this category and also higher in
the hieararchy depending on the value of the additivity flag.
WARNING Note that passing a Throwable
to this method will
print the name of the Throwable but no stack trace. To print a stack
trace use the Category.warn(Object,Throwable)
form instead.
public void warn(Object message, Throwable t)
Category
WARN
level including the stack trace
of the Throwable
t
passed as parameter.
See Category.warn(Object)
for more detailed information.
public static void dispose()
Copyright © 2013. All Rights Reserved.