|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.logging.log4j.core.LoggerContext
public class LoggerContext
The LoggerContext is the anchor for the logging system. It maintains a list of all the loggers requested by applications and a reference to the Configuration. The Configuration will contain the configured loggers, appenders, filters, etc and will be atomically updated whenever a reconfigure occurs.
Nested Class Summary | |
---|---|
static class |
LoggerContext.Status
Status of the LoggerContext. |
Constructor Summary | |
---|---|
LoggerContext(String name)
Constructor taking only a name. |
|
LoggerContext(String name,
Object externalContext)
Constructor taking a name and a reference to an external context. |
|
LoggerContext(String name,
Object externalContext,
String configLocn)
Constructor taking a name external context and a configuration location String. |
|
LoggerContext(String name,
Object externalContext,
URI configLocn)
Constructor taking a name, external context and a configuration URI. |
Method Summary | |
---|---|
void |
addFilter(Filter filter)
Add a Filter to the Configuration. |
Configuration |
getConfiguration()
Returns the current Configuration. |
Object |
getExternalContext()
Returns the external context. |
Logger |
getLogger(String name)
Obtain a Logger from the Context. |
String |
getName()
Gets the name. |
LoggerContext.Status |
getStatus()
|
boolean |
hasLogger(String name)
Determine if the specified Logger exists. |
boolean |
isStarted()
|
void |
onChange(Reconfigurable reconfigurable)
Cause a reconfiguration to take place when the underlying configuration file changes. |
void |
reconfigure()
Reconfigure the context. |
void |
removeFiler(Filter filter)
Removes a Filter from the current Configuration. |
Configuration |
setConfiguration(Configuration config)
Set the Configuration to be used. |
void |
setExternalContext(Object context)
Set the external context. |
void |
start()
|
void |
stop()
|
void |
updateLoggers()
Cause all Loggers to be updated against the current Configuration. |
void |
updateLoggers(Configuration config)
Cause all Logger to be updated against the specified Configuration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LoggerContext(String name)
name
- The context name.public LoggerContext(String name, Object externalContext)
name
- The context name.externalContext
- The external context.public LoggerContext(String name, Object externalContext, URI configLocn)
name
- The context name.externalContext
- The external context.configLocn
- The location of the configuration as a URI.public LoggerContext(String name, Object externalContext, String configLocn)
name
- The configuration location.externalContext
- The external context.configLocn
- The configuration location.Method Detail |
---|
public void start()
start
in interface LifeCycle
public void stop()
stop
in interface LifeCycle
public String getName()
public LoggerContext.Status getStatus()
public boolean isStarted()
isStarted
in interface LifeCycle
public void setExternalContext(Object context)
context
- The external context.public Object getExternalContext()
getExternalContext
in interface org.apache.logging.log4j.spi.LoggerContext
public Logger getLogger(String name)
getLogger
in interface org.apache.logging.log4j.spi.LoggerContext
name
- The name of the Logger to return.
public boolean hasLogger(String name)
hasLogger
in interface org.apache.logging.log4j.spi.LoggerContext
name
- The Logger name to search for.
public Configuration getConfiguration()
public void addFilter(Filter filter)
filter
- The Filter to add.public void removeFiler(Filter filter)
filter
- The Filter to remove.public Configuration setConfiguration(Configuration config)
config
- The new Configuration.
public void reconfigure()
public void updateLoggers()
public void updateLoggers(Configuration config)
config
- The Configuration.public void onChange(Reconfigurable reconfigurable)
onChange
in interface ConfigurationListener
reconfigurable
- The Configuration that can be reconfigured.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |