public abstract class AbstractLogger extends Object implements ExtendedLogger, Serializable
Modifier and Type | Field and Description |
---|---|
static Marker |
CATCHING_MARKER
Marker for catching exceptions.
|
static Class<? extends MessageFactory> |
DEFAULT_MESSAGE_FACTORY_CLASS
The default MessageFactory class.
|
static Marker |
ENTRY_MARKER
Marker for method entry tracing.
|
static Marker |
EXCEPTION_MARKER
Marker for exception tracing.
|
static Marker |
EXIT_MARKER
Marker for method exit tracing.
|
static Marker |
FLOW_MARKER
Marker for flow tracing.
|
static Marker |
THROWING_MARKER
Marker for throwing exceptions.
|
Constructor and Description |
---|
AbstractLogger()
Creates a new logger named after this class (or subclass).
|
AbstractLogger(String name)
Creates a new named logger.
|
AbstractLogger(String name,
MessageFactory messageFactory)
Creates a new named logger with a particular
MessageFactory . |
Modifier and Type | Method and Description |
---|---|
void |
catching(Level level,
Throwable t)
Logs an exception or error that has been caught to a specific logging level.
|
protected void |
catching(String fqcn,
Level level,
Throwable t)
Logs a Throwable that has been caught with location information.
|
void |
catching(Throwable t)
Logs an exception or error that has been caught.
|
protected Message |
catchingMsg(Throwable t) |
static void |
checkMessageFactory(ExtendedLogger logger,
MessageFactory messageFactory)
Checks that the message factory a logger was created with is the same as the given messageFactory.
|
void |
debug(Marker marker,
Message msg)
Logs a message with the specific Marker at the
DEBUG level. |
void |
debug(Marker marker,
Message msg,
Throwable t)
Logs a message with the specific Marker at the
DEBUG level. |
void |
debug(Marker marker,
Object message)
Logs a message object with the
DEBUG level. |
void |
debug(Marker marker,
Object message,
Throwable t)
|
void |
debug(Marker marker,
String message)
Logs a message object with the
DEBUG level. |
void |
debug(Marker marker,
String message,
Object... params)
Logs a message with parameters at the
DEBUG level. |
void |
debug(Marker marker,
String message,
Throwable t)
|
void |
debug(Message msg)
Logs a message with the specific Marker at the
DEBUG level. |
void |
debug(Message msg,
Throwable t)
Logs a message with the specific Marker at the
DEBUG level. |
void |
debug(Object message)
Logs a message object with the
DEBUG level. |
void |
debug(Object message,
Throwable t)
|
void |
debug(String message)
Logs a message object with the
DEBUG level. |
void |
debug(String message,
Object... params)
Logs a message with parameters at the
DEBUG level. |
void |
debug(String message,
Throwable t)
|
void |
entry()
Logs entry to a method.
|
void |
entry(Object... params)
Logs entry to a method along with its parameters.
|
protected void |
entry(String fqcn,
Object... params)
Logs entry to a method with location information.
|
protected Message |
entryMsg(int count,
Object... params) |
void |
error(Marker marker,
Message msg)
Logs a message with the specific Marker at the
ERROR level. |
void |
error(Marker marker,
Message msg,
Throwable t)
Logs a message with the specific Marker at the
ERROR level. |
void |
error(Marker marker,
Object message)
Logs a message object with the
ERROR level. |
void |
error(Marker marker,
Object message,
Throwable t)
|
void |
error(Marker marker,
String message)
Logs a message object with the
ERROR level. |
void |
error(Marker marker,
String message,
Object... params)
Logs a message with parameters at the
ERROR level. |
void |
error(Marker marker,
String message,
Throwable t)
|
void |
error(Message msg)
Logs a message with the specific Marker at the
ERROR level. |
void |
error(Message msg,
Throwable t)
Logs a message with the specific Marker at the
ERROR level. |
void |
error(Object message)
Logs a message object with the
ERROR level. |
void |
error(Object message,
Throwable t)
|
void |
error(String message)
Logs a message object with the
ERROR level. |
void |
error(String message,
Object... params)
Logs a message with parameters at the
ERROR level. |
void |
error(String message,
Throwable t)
|
void |
exit()
Logs exit from a method.
|
<R> R |
exit(R result)
Logs exiting from a method with the result.
|
protected <R> R |
exit(String fqcn,
R result)
Logs exiting from a method with the result and location information.
|
protected Message |
exitMsg(Object result) |
void |
fatal(Marker marker,
Message msg)
Logs a message with the specific Marker at the
FATAL level. |
void |
fatal(Marker marker,
Message msg,
Throwable t)
Logs a message with the specific Marker at the
FATAL level. |
void |
fatal(Marker marker,
Object message)
Logs a message object with the
FATAL level. |
void |
fatal(Marker marker,
Object message,
Throwable t)
|
void |
fatal(Marker marker,
String message)
Logs a message object with the
FATAL level. |
void |
fatal(Marker marker,
String message,
Object... params)
Logs a message with parameters at the
FATAL level. |
void |
fatal(Marker marker,
String message,
Throwable t)
|
void |
fatal(Message msg)
Logs a message with the specific Marker at the
FATAL level. |
void |
fatal(Message msg,
Throwable t)
Logs a message with the specific Marker at the
FATAL level. |
void |
fatal(Object message)
Logs a message object with the
FATAL level. |
void |
fatal(Object message,
Throwable t)
|
void |
fatal(String message)
Logs a message object with the
FATAL level. |
void |
fatal(String message,
Object... params)
Logs a message with parameters at the
FATAL level. |
void |
fatal(String message,
Throwable t)
|
MessageFactory |
getMessageFactory()
Gets the message factory used to convert message Objects and Strings into actual log Messages.
|
String |
getName()
Gets the logger name.
|
void |
info(Marker marker,
Message msg)
Logs a message with the specific Marker at the
INFO level. |
void |
info(Marker marker,
Message msg,
Throwable t)
Logs a message with the specific Marker at the
INFO level. |
void |
info(Marker marker,
Object message)
Logs a message object with the
INFO level. |
void |
info(Marker marker,
Object message,
Throwable t)
|
void |
info(Marker marker,
String message)
Logs a message object with the
INFO level. |
void |
info(Marker marker,
String message,
Object... params)
Logs a message with parameters at the
INFO level. |
void |
info(Marker marker,
String message,
Throwable t)
|
void |
info(Message msg)
Logs a message with the specific Marker at the
INFO level. |
void |
info(Message msg,
Throwable t)
Logs a message with the specific Marker at the
INFO level. |
void |
info(Object message)
Logs a message object with the
INFO level. |
void |
info(Object message,
Throwable t)
|
void |
info(String message)
Logs a message object with the
INFO level. |
void |
info(String message,
Object... params)
Logs a message with parameters at the
INFO level. |
void |
info(String message,
Throwable t)
|
boolean |
isDebugEnabled()
Checks whether this Logger is enabled for the
DEBUG Level. |
boolean |
isDebugEnabled(Marker marker)
Checks whether this Logger is enabled for the
DEBUG Level. |
boolean |
isEnabled(Level level)
Checks whether this Logger is enabled for the the given Level.
|
boolean |
isEnabled(Level level,
Marker marker)
Checks whether this logger is enabled at the specified level and an optional Marker.
|
boolean |
isErrorEnabled()
Checks whether this Logger is enabled for the
ERROR Level. |
boolean |
isErrorEnabled(Marker marker)
Checks whether this Logger is enabled for the
ERROR Level. |
boolean |
isFatalEnabled()
Checks whether this Logger is enabled for the
FATAL Level. |
boolean |
isFatalEnabled(Marker marker)
Checks whether this Logger is enabled for the
FATAL Level. |
boolean |
isInfoEnabled()
Checks whether this Logger is enabled for the
INFO Level. |
boolean |
isInfoEnabled(Marker marker)
Checks whether this Logger is enabled for the
INFO Level. |
boolean |
isTraceEnabled()
Checks whether this Logger is enabled for the
TRACE level. |
boolean |
isTraceEnabled(Marker marker)
Checks whether this Logger is enabled for the
TRACE level. |
boolean |
isWarnEnabled()
Checks whether this Logger is enabled for the
WARN Level. |
boolean |
isWarnEnabled(Marker marker)
Checks whether this Logger is enabled for the
WARN Level. |
void |
log(Level level,
Marker marker,
Message msg)
Logs a message with the specific Marker at the given level.
|
void |
log(Level level,
Marker marker,
Message msg,
Throwable t)
Logs a message with the specific Marker at the given level.
|
void |
log(Level level,
Marker marker,
Object message)
Logs a message object with the given level.
|
void |
log(Level level,
Marker marker,
Object message,
Throwable t)
Logs a message at the given level including the stack trace of the
Throwable t passed as
parameter. |
void |
log(Level level,
Marker marker,
String message)
Logs a message object with the given level.
|
void |
log(Level level,
Marker marker,
String message,
Object... params)
Logs a message with parameters at the given level.
|
void |
log(Level level,
Marker marker,
String message,
Throwable t)
Logs a message at the given level including the stack trace of the
Throwable t passed as
parameter. |
void |
log(Level level,
Message msg)
Logs a message with the specific Marker at the given level.
|
void |
log(Level level,
Message msg,
Throwable t)
Logs a message with the specific Marker at the given level.
|
void |
log(Level level,
Object message)
Logs a message object with the given level.
|
void |
log(Level level,
Object message,
Throwable t)
Logs a message at the given level including the stack trace of the
Throwable t passed as
parameter. |
void |
log(Level level,
String message)
Logs a message object with the given level.
|
void |
log(Level level,
String message,
Object... params)
Logs a message with parameters at the given level.
|
void |
log(Level level,
String message,
Throwable t)
Logs a message at the given level including the stack trace of the
Throwable t passed as
parameter. |
void |
logIfEnabled(String fqcn,
Level level,
Marker marker,
Message msg,
Throwable t)
Logs a message if the specified level is active.
|
void |
logIfEnabled(String fqcn,
Level level,
Marker marker,
Object message,
Throwable t)
Logs a message if the specified level is active.
|
void |
logIfEnabled(String fqcn,
Level level,
Marker marker,
String message)
Logs a message if the specified level is active.
|
void |
logIfEnabled(String fqcn,
Level level,
Marker marker,
String message,
Object... params)
Logs a message if the specified level is active.
|
void |
logIfEnabled(String fqcn,
Level level,
Marker marker,
String message,
Throwable t)
Logs a message if the specified level is active.
|
protected void |
logMessage(String fqcn,
Level level,
Marker marker,
Object message,
Throwable t) |
protected void |
logMessage(String fqcn,
Level level,
Marker marker,
String message) |
protected void |
logMessage(String fqcn,
Level level,
Marker marker,
String message,
Object... params) |
protected void |
logMessage(String fqcn,
Level level,
Marker marker,
String message,
Throwable t) |
void |
printf(Level level,
Marker marker,
String format,
Object... params)
Logs a formatted message using the specified format string and arguments.
|
void |
printf(Level level,
String format,
Object... params)
Logs a formatted message using the specified format string and arguments.
|
<T extends Throwable> |
throwing(Level level,
T t)
Logs an exception or error to be thrown.
|
protected <T extends Throwable> |
throwing(String fqcn,
Level level,
T t)
Logs a Throwable to be thrown.
|
<T extends Throwable> |
throwing(T t)
Logs an exception or error to be thrown.
|
protected Message |
throwingMsg(Throwable t) |
void |
trace(Marker marker,
Message msg)
Logs a message with the specific Marker at the
TRACE level. |
void |
trace(Marker marker,
Message msg,
Throwable t)
Logs a message with the specific Marker at the
TRACE level. |
void |
trace(Marker marker,
Object message)
Logs a message object with the
TRACE level. |
void |
trace(Marker marker,
Object message,
Throwable t)
|
void |
trace(Marker marker,
String message)
Logs a message object with the
TRACE level. |
void |
trace(Marker marker,
String message,
Object... params)
Logs a message with parameters at the
TRACE level. |
void |
trace(Marker marker,
String message,
Throwable t)
|
void |
trace(Message msg)
Logs a message with the specific Marker at the
TRACE level. |
void |
trace(Message msg,
Throwable t)
Logs a message with the specific Marker at the
TRACE level. |
void |
trace(Object message)
Logs a message object with the
TRACE level. |
void |
trace(Object message,
Throwable t)
|
void |
trace(String message)
Logs a message object with the
TRACE level. |
void |
trace(String message,
Object... params)
Logs a message with parameters at the
TRACE level. |
void |
trace(String message,
Throwable t)
|
void |
warn(Marker marker,
Message msg)
Logs a message with the specific Marker at the
WARN level. |
void |
warn(Marker marker,
Message msg,
Throwable t)
Logs a message with the specific Marker at the
WARN level. |
void |
warn(Marker marker,
Object message)
Logs a message object with the
WARN level. |
void |
warn(Marker marker,
Object message,
Throwable t)
|
void |
warn(Marker marker,
String message)
Logs a message object with the
WARN level. |
void |
warn(Marker marker,
String message,
Object... params)
Logs a message with parameters at the
WARN level. |
void |
warn(Marker marker,
String message,
Throwable t)
|
void |
warn(Message msg)
Logs a message with the specific Marker at the
WARN level. |
void |
warn(Message msg,
Throwable t)
Logs a message with the specific Marker at the
WARN level. |
void |
warn(Object message)
Logs a message object with the
WARN level. |
void |
warn(Object message,
Throwable t)
|
void |
warn(String message)
Logs a message object with the
WARN level. |
void |
warn(String message,
Object... params)
Logs a message with parameters at the
WARN level. |
void |
warn(String message,
Throwable t)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, logMessage
public static final Marker FLOW_MARKER
public static final Marker ENTRY_MARKER
public static final Marker EXIT_MARKER
public static final Marker EXCEPTION_MARKER
public static final Marker THROWING_MARKER
public static final Marker CATCHING_MARKER
public static final Class<? extends MessageFactory> DEFAULT_MESSAGE_FACTORY_CLASS
public AbstractLogger()
public AbstractLogger(String name)
name
- the logger namepublic AbstractLogger(String name, MessageFactory messageFactory)
MessageFactory
.name
- the logger namemessageFactory
- the message factory, if null then use the default message factory.public static void checkMessageFactory(ExtendedLogger logger, MessageFactory messageFactory)
DEFAULT_MESSAGE_FACTORY_CLASS
.logger
- The logger to checkmessageFactory
- The message factory to check.public void catching(Level level, Throwable t)
Logger
protected void catching(String fqcn, Level level, Throwable t)
fqcn
- The fully qualified class name of the caller.level
- The logging level.t
- The Throwable.public void catching(Throwable t)
Logger
main()
method), this method is ideal for it.protected Message catchingMsg(Throwable t)
public void debug(Marker marker, Message msg)
Logger
DEBUG
level.public void debug(Marker marker, Message msg, Throwable t)
Logger
DEBUG
level.public void debug(Marker marker, Object message)
Logger
DEBUG
level.public void debug(Marker marker, Object message, Throwable t)
Logger
public void debug(Marker marker, String message)
Logger
DEBUG
level.public void debug(Marker marker, String message, Object... params)
Logger
DEBUG
level.debug
in interface Logger
marker
- the marker data specific to this log statementmessage
- the message to log; the format depends on the message factory.params
- parameters to the message.Logger.getMessageFactory()
public void debug(Marker marker, String message, Throwable t)
Logger
public void debug(Message msg)
Logger
DEBUG
level.public void debug(Message msg, Throwable t)
Logger
DEBUG
level.public void debug(Object message)
Logger
DEBUG
level.public void debug(String message)
Logger
DEBUG
level.public void debug(String message, Object... params)
Logger
DEBUG
level.debug
in interface Logger
message
- the message to log; the format depends on the message factory.params
- parameters to the message.Logger.getMessageFactory()
public void entry()
Logger
public void entry(Object... params)
Logger
public void doSomething(String foo, int bar) { LOGGER.entry(foo, bar); // do something }
The use of methods such as this are more effective when combined with aspect-oriented programming or other bytecode manipulation tools. It can be rather tedious (and messy) to use this type of method manually.
entry
in interface Logger
params
- The parameters to the method.
TODO Use of varargs results in array creation which can be a substantial portion of no-op case. LogMF/LogSF
provides several overrides to avoid vararg except in edge cases. (RG) LogMF and LogSF implement these in
LogXF which calls logger.callAppenders. callAppenders is part of the implementation and cannot be used by
the API. Adding more methods here and in AbstractLogger is sufficient.protected void entry(String fqcn, Object... params)
fqcn
- The fully qualified class name of the caller.params
- The parameters to the method.public void error(Marker marker, Message msg)
Logger
ERROR
level.public void error(Marker marker, Message msg, Throwable t)
Logger
ERROR
level.public void error(Marker marker, Object message)
Logger
ERROR
level.public void error(Marker marker, Object message, Throwable t)
Logger
public void error(Marker marker, String message)
Logger
ERROR
level.public void error(Marker marker, String message, Object... params)
Logger
ERROR
level.error
in interface Logger
marker
- the marker data specific to this log statement.message
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call. (RG) I assume you meant error, not info. It isn't possible to be
misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
1, 2 or 3 parameters.
public void error(Marker marker, String message, Throwable t)
Logger
public void error(Message msg)
Logger
ERROR
level.public void error(Message msg, Throwable t)
Logger
ERROR
level.public void error(Object message)
Logger
ERROR
level.public void error(String message)
Logger
ERROR
level.public void error(String message, Object... params)
Logger
ERROR
level.error
in interface Logger
message
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call. (RG) I assume you meant error, not info. It isn't possible to be
misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
1, 2 or 3 parameters.
public void exit()
Logger
public <R> R exit(R result)
Logger
return LOGGER.exit(myResult);
protected <R> R exit(String fqcn, R result)
R
- The type of the parameter and object being returned.fqcn
- The fully qualified class name of the caller.result
- The result being returned from the method call.public void fatal(Marker marker, Message msg)
Logger
FATAL
level.public void fatal(Marker marker, Message msg, Throwable t)
Logger
FATAL
level.public void fatal(Marker marker, Object message)
Logger
FATAL
level.public void fatal(Marker marker, Object message, Throwable t)
Logger
public void fatal(Marker marker, String message)
Logger
FATAL
level.public void fatal(Marker marker, String message, Object... params)
Logger
FATAL
level.fatal
in interface Logger
marker
- The marker data specific to this log statement.message
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call.(RG) I assume you meant fatal, not info. It isn't possible to be
misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
1, 2 or 3 parameters.
public void fatal(Marker marker, String message, Throwable t)
Logger
public void fatal(Message msg)
Logger
FATAL
level.public void fatal(Message msg, Throwable t)
Logger
FATAL
level.public void fatal(Object message)
Logger
FATAL
level.public void fatal(String message)
Logger
FATAL
level.public void fatal(String message, Object... params)
Logger
FATAL
level.fatal
in interface Logger
message
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call.(RG) I assume you meant fatal, not info. It isn't possible to be
misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
1, 2 or 3 parameters.
public MessageFactory getMessageFactory()
Logger
getMessageFactory
in interface Logger
public void info(Marker marker, Message msg)
Logger
INFO
level.public void info(Marker marker, Message msg, Throwable t)
Logger
INFO
level.public void info(Marker marker, Object message)
Logger
INFO
level.public void info(Marker marker, Object message, Throwable t)
Logger
public void info(Marker marker, String message)
Logger
INFO
level.public void info(Marker marker, String message, Object... params)
Logger
INFO
level.info
in interface Logger
marker
- the marker data specific to this log statementmessage
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call. (RG) It isn't possible to be misinterpreted as the previous method
is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters.
public void info(Marker marker, String message, Throwable t)
Logger
public void info(Message msg)
Logger
INFO
level.public void info(Message msg, Throwable t)
Logger
INFO
level.public void info(Object message)
Logger
INFO
level.public void info(String message)
Logger
INFO
level.public void info(String message, Object... params)
Logger
INFO
level.info
in interface Logger
message
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call. (RG) It isn't possible to be misinterpreted as the previous method
is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters.
public boolean isDebugEnabled()
Logger
DEBUG
Level.isDebugEnabled
in interface Logger
true
if this Logger is enabled for level DEBUG, false
otherwise.public boolean isDebugEnabled(Marker marker)
Logger
DEBUG
Level.isDebugEnabled
in interface Logger
marker
- The marker data specific to this log statement.true
if this Logger is enabled for level DEBUG, false
otherwise.public boolean isEnabled(Level level)
Logger
Note that passing in OFF
always returns true
.
public boolean isEnabled(Level level, Marker marker)
Logger
public boolean isErrorEnabled()
Logger
ERROR
Level.isErrorEnabled
in interface Logger
true
if this Logger is enabled for level ERROR
, false
otherwise.public boolean isErrorEnabled(Marker marker)
Logger
ERROR
Level.isErrorEnabled
in interface Logger
marker
- The marker data specific to this log statement.true
if this Logger is enabled for level ERROR
, false
otherwise.public boolean isFatalEnabled()
Logger
FATAL
Level.isFatalEnabled
in interface Logger
true
if this Logger is enabled for level FATAL
, false
otherwise.public boolean isFatalEnabled(Marker marker)
Logger
FATAL
Level.isFatalEnabled
in interface Logger
marker
- The marker data specific to this log statement.true
if this Logger is enabled for level FATAL
, false
otherwise.public boolean isInfoEnabled()
Logger
INFO
Level.isInfoEnabled
in interface Logger
true
if this Logger is enabled for level INFO, false
otherwise.public boolean isInfoEnabled(Marker marker)
Logger
INFO
Level.isInfoEnabled
in interface Logger
marker
- The marker data specific to this log statement.true
if this Logger is enabled for level INFO, false
otherwise.public boolean isTraceEnabled()
Logger
TRACE
level.isTraceEnabled
in interface Logger
true
if this Logger is enabled for level TRACE, false
otherwise.public boolean isTraceEnabled(Marker marker)
Logger
TRACE
level.isTraceEnabled
in interface Logger
marker
- The marker data specific to this log statement.true
if this Logger is enabled for level TRACE, false
otherwise.public boolean isWarnEnabled()
Logger
WARN
Level.isWarnEnabled
in interface Logger
true
if this Logger is enabled for level WARN
, false
otherwise.public boolean isWarnEnabled(Marker marker)
Logger
WARN
Level.isWarnEnabled
in interface Logger
marker
- The marker data specific to this log statement.true
if this Logger is enabled for level WARN
, false
otherwise.public void log(Level level, Marker marker, Message msg)
Logger
public void log(Level level, Marker marker, Message msg, Throwable t)
Logger
public void log(Level level, Marker marker, Object message)
Logger
public void log(Level level, Marker marker, Object message, Throwable t)
Logger
Throwable
t
passed as
parameter.public void log(Level level, Marker marker, String message)
Logger
public void log(Level level, Marker marker, String message, Object... params)
Logger
log
in interface Logger
level
- the logging levelmarker
- the marker data specific to this log statementmessage
- the message to log; the format depends on the message factory.params
- parameters to the message.Logger.getMessageFactory()
public void log(Level level, Marker marker, String message, Throwable t)
Logger
Throwable
t
passed as
parameter.public void log(Level level, Message msg)
Logger
public void log(Level level, Message msg, Throwable t)
Logger
public void log(Level level, Object message)
Logger
public void log(Level level, Object message, Throwable t)
Logger
Throwable
t
passed as
parameter.public void log(Level level, String message)
Logger
public void log(Level level, String message, Object... params)
Logger
log
in interface Logger
level
- the logging levelmessage
- the message to log; the format depends on the message factory.params
- parameters to the message.Logger.getMessageFactory()
public void log(Level level, String message, Throwable t)
Logger
Throwable
t
passed as
parameter.public void logIfEnabled(String fqcn, Level level, Marker marker, Message msg, Throwable t)
ExtendedLogger
logIfEnabled
in interface ExtendedLogger
fqcn
- The fully qualified class name of the logger entry point, used to determine the caller class and
method when location information needs to be logged.level
- The logging Level to check.marker
- A Marker or null.msg
- The Message.t
- the exception to log, including its stack trace.public void logIfEnabled(String fqcn, Level level, Marker marker, Object message, Throwable t)
ExtendedLogger
logIfEnabled
in interface ExtendedLogger
fqcn
- The fully qualified class name of the logger entry point, used to determine the caller class and
method when location information needs to be logged.level
- The logging Level to check.marker
- A Marker or null.message
- The message.t
- the exception to log, including its stack trace.public void logIfEnabled(String fqcn, Level level, Marker marker, String message)
ExtendedLogger
logIfEnabled
in interface ExtendedLogger
fqcn
- The fully qualified class name of the logger entry point, used to determine the caller class and
method when location information needs to be logged.level
- The logging Level to check.marker
- A Marker or null.message
- The message.public void logIfEnabled(String fqcn, Level level, Marker marker, String message, Object... params)
ExtendedLogger
logIfEnabled
in interface ExtendedLogger
fqcn
- The fully qualified class name of the logger entry point, used to determine the caller class and
method when location information needs to be logged.level
- The logging Level to check.marker
- A Marker or null.message
- The message format.params
- The message parameters.public void logIfEnabled(String fqcn, Level level, Marker marker, String message, Throwable t)
ExtendedLogger
logIfEnabled
in interface ExtendedLogger
fqcn
- The fully qualified class name of the logger entry point, used to determine the caller class and
method when location information needs to be logged.level
- The logging Level to check.marker
- A Marker or null.message
- The message.t
- the exception to log, including its stack trace.protected void logMessage(String fqcn, Level level, Marker marker, Object message, Throwable t)
protected void logMessage(String fqcn, Level level, Marker marker, String message, Throwable t)
protected void logMessage(String fqcn, Level level, Marker marker, String message)
protected void logMessage(String fqcn, Level level, Marker marker, String message, Object... params)
public void printf(Level level, Marker marker, String format, Object... params)
Logger
public void printf(Level level, String format, Object... params)
Logger
public <T extends Throwable> T throwing(T t)
Logger
throw logger.throwing(myException);
public <T extends Throwable> T throwing(Level level, T t)
Logger
throw logger.throwing(Level.DEBUG, myException);
protected <T extends Throwable> T throwing(String fqcn, Level level, T t)
T
- the type of the Throwable.fqcn
- the fully qualified class name of this Logger implementation.level
- The logging Level.t
- The Throwable.protected Message throwingMsg(Throwable t)
public void trace(Marker marker, Message msg)
Logger
TRACE
level.public void trace(Marker marker, Message msg, Throwable t)
Logger
TRACE
level.public void trace(Marker marker, Object message)
Logger
TRACE
level.public void trace(Marker marker, Object message, Throwable t)
Logger
trace
in interface Logger
marker
- the marker data specific to this log statementmessage
- the message object to log.t
- the exception to log, including its stack trace.Logger.debug(String)
public void trace(Marker marker, String message)
Logger
TRACE
level.public void trace(Marker marker, String message, Object... params)
Logger
TRACE
level.trace
in interface Logger
marker
- the marker data specific to this log statementmessage
- the message to log; the format depends on the message factory.params
- parameters to the message.Logger.getMessageFactory()
public void trace(Marker marker, String message, Throwable t)
Logger
trace
in interface Logger
marker
- the marker data specific to this log statementmessage
- the message object to log.t
- the exception to log, including its stack trace.Logger.debug(String)
public void trace(Message msg)
Logger
TRACE
level.public void trace(Message msg, Throwable t)
Logger
TRACE
level.public void trace(Object message)
Logger
TRACE
level.public void trace(Object message, Throwable t)
Logger
trace
in interface Logger
message
- the message object to log.t
- the exception to log, including its stack trace.Logger.debug(String)
public void trace(String message)
Logger
TRACE
level.public void trace(String message, Object... params)
Logger
TRACE
level.trace
in interface Logger
message
- the message to log; the format depends on the message factory.params
- parameters to the message.Logger.getMessageFactory()
public void trace(String message, Throwable t)
Logger
trace
in interface Logger
message
- the message object to log.t
- the exception to log, including its stack trace.Logger.debug(String)
public void warn(Marker marker, Message msg)
Logger
WARN
level.public void warn(Marker marker, Message msg, Throwable t)
Logger
WARN
level.public void warn(Marker marker, Object message)
Logger
WARN
level.public void warn(Marker marker, Object message, Throwable t)
Logger
public void warn(Marker marker, String message)
Logger
WARN
level.public void warn(Marker marker, String message, Object... params)
Logger
WARN
level.warn
in interface Logger
marker
- the marker data specific to this log statement.message
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call. (RG) I assume you meant warn, not info. It isn't possible to be
misinterpreted as the previous method is for that signature.Methods should be added to avoid varargs for
1, 2 or 3 parameters.
public void warn(Marker marker, String message, Throwable t)
Logger
public void warn(Message msg)
Logger
WARN
level.public void warn(Message msg, Throwable t)
Logger
WARN
level.public void warn(Object message)
Logger
WARN
level.public void warn(String message)
Logger
WARN
level.public void warn(String message, Object... params)
Logger
WARN
level.warn
in interface Logger
message
- the message to log; the format depends on the message factory.params
- parameters to the message.TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
array creation expense on every call. (RG) I assume you meant warn, not info. It isn't possible to be
misinterpreted as the previous method is for that signature.Methods should be added to avoid varargs for
1, 2 or 3 parameters.
Copyright © 1999-2021 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.