public class Logger extends AbstractLogger
Modifier and Type | Class and Description |
---|---|
protected class |
Logger.PrivateConfig
The binding between a Logger and its configuration.
|
Modifier and Type | Field and Description |
---|---|
protected Logger.PrivateConfig |
config
config should be consistent across threads.
|
CATCHING_MARKER, DEFAULT_MESSAGE_FACTORY_CLASS, ENTRY_MARKER, EXCEPTION_MARKER, EXIT_MARKER, FLOW_MARKER, THROWING_MARKER
Modifier | Constructor and Description |
---|---|
protected |
Logger(LoggerContext context,
String name,
MessageFactory messageFactory)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAppender(Appender appender)
This method is not exposed through the public API and is used primarily for unit testing.
|
void |
addFilter(Filter filter)
This method is not exposed through the public API and is used primarily for unit testing.
|
int |
filterCount()
This method is not exposed through the public API and is used primarily for unit testing.
|
Map<String,Appender> |
getAppenders()
This method is not exposed through the public API and is used primarily for unit testing.
|
LoggerContext |
getContext()
Returns the LoggerContext this Logger is associated with.
|
Iterator<Filter> |
getFilters()
This method is not exposed through the public API and is used primarily for unit testing.
|
Level |
getLevel()
Returns the Level associated with the Logger.
|
Logger |
getParent()
This method is only used for 1.x compatibility.
|
boolean |
isAdditive()
This method is not exposed through the public API and is present only to support the Log4j 1.2
compatibility bridge.
|
boolean |
isEnabled(Level level,
Marker marker,
Message msg,
Throwable t)
Determine if logging is enabled.
|
boolean |
isEnabled(Level level,
Marker marker,
Object msg,
Throwable t)
Determine if logging is enabled.
|
boolean |
isEnabled(Level level,
Marker marker,
String msg)
Determine if logging is enabled.
|
boolean |
isEnabled(Level level,
Marker marker,
String msg,
Object... p1)
Determine if logging is enabled.
|
boolean |
isEnabled(Level level,
Marker marker,
String msg,
Throwable t)
Determine if logging is enabled.
|
void |
log(Marker marker,
String fqcn,
Level level,
Message data,
Throwable t)
Logs a message with location information.
|
void |
removeAppender(Appender appender)
This method is not exposed through the public API and is used primarily for unit testing.
|
void |
setAdditive(boolean additive)
This method is not exposed through the public API and is present only to support the Log4j 1.2
compatibility bridge.
|
void |
setLevel(Level level)
This method is not exposed through the public API and is provided primarily for unit testing.
|
String |
toString()
Returns a String representation of this instance in the form
"name:level[ in context_name]" . |
catching, catching, catching, checkMessageFactory, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, entry, entry, entry, error, error, error, error, error, error, error, error, error, error, error, error, error, error, exit, exit, exit, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, getMessageFactory, getName, info, info, info, info, info, info, info, info, info, info, info, info, info, info, isDebugEnabled, isDebugEnabled, isEnabled, isEnabled, isErrorEnabled, isErrorEnabled, isFatalEnabled, isFatalEnabled, isInfoEnabled, isInfoEnabled, isTraceEnabled, isTraceEnabled, isWarnEnabled, isWarnEnabled, log, log, log, log, log, log, log, log, log, log, log, log, log, log, printf, printf, throwing, throwing, throwing, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn
protected volatile Logger.PrivateConfig config
protected Logger(LoggerContext context, String name, MessageFactory messageFactory)
context
- The LoggerContext this Logger is associated with.messageFactory
- The message factory.name
- The name of the Logger.public Logger getParent()
public LoggerContext getContext()
public void setLevel(Level level)
level
- The Level to use on this Logger.public Level getLevel()
public void log(Marker marker, String fqcn, Level level, Message data, Throwable t)
AbstractLogger
log
in class AbstractLogger
marker
- The Markerfqcn
- The fully qualified class name of the callerlevel
- The logging leveldata
- The Message.t
- A Throwable or null.public boolean isEnabled(Level level, Marker marker, String msg)
AbstractLogger
isEnabled
in class AbstractLogger
level
- The logging Level to check.marker
- A Marker or null.msg
- The message.public boolean isEnabled(Level level, Marker marker, String msg, Throwable t)
AbstractLogger
isEnabled
in class AbstractLogger
level
- The logging Level to check.marker
- A Marker or null.msg
- The message.t
- A Throwable.public boolean isEnabled(Level level, Marker marker, String msg, Object... p1)
AbstractLogger
isEnabled
in class AbstractLogger
level
- The logging Level to check.marker
- A Marker or null.msg
- The message.p1
- The parameters.public boolean isEnabled(Level level, Marker marker, Object msg, Throwable t)
AbstractLogger
isEnabled
in class AbstractLogger
level
- The logging Level to check.marker
- A Marker or null.msg
- The message.t
- A Throwable.public boolean isEnabled(Level level, Marker marker, Message msg, Throwable t)
AbstractLogger
isEnabled
in class AbstractLogger
level
- The logging Level to check.marker
- A Marker or null.msg
- The Message.t
- A Throwable.public void addAppender(Appender appender)
appender
- The Appender to add to the Logger.public void removeAppender(Appender appender)
appender
- The Appender to remove from the Logger.public Map<String,Appender> getAppenders()
public Iterator<Filter> getFilters()
public int filterCount()
public void addFilter(Filter filter)
filter
- The Filter to add.public boolean isAdditive()
public void setAdditive(boolean additive)
additive
- Boolean value to indicate whether the Logger is additive or not.public String toString()
"name:level[ in context_name]"
.toString
in class AbstractLogger
Copyright © 1999-2014 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.