public interface LoggerRepositoryEx
extends org.apache.log4j.spi.LoggerRepository
LoggerRepository
is used to create and retrieve
Loggers
. The relation between loggers in a repository
depends on the repository but typically loggers are arranged in a
named hierarchy.
In addition to the creational methods, a
LoggerRepository
can be queried for existing loggers,
can act as a point of registry for events related to loggers.
Modifier and Type | Method and Description |
---|---|
void |
addErrorItem(ErrorItem errorItem)
Errors which cannot be logged, go to the error list.
|
void |
addLoggerEventListener(LoggerEventListener listener)
Add a
LoggerEventListener to the repository. |
void |
addLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)
Add a
LoggerRepositoryEventListener to the repository. |
void |
fireConfigurationChangedEvent()
Requests that a configuration changed event be sent to any registered
LoggerRepositoryEventListener . |
void |
fireLevelChangedEvent(org.apache.log4j.Logger logger)
Requests that a level changed event be sent to any registered
LoggerEventListener . |
void |
fireRemoveAppenderEvent(org.apache.log4j.Category logger,
org.apache.log4j.Appender appender)
Requests that a appender removed event be sent to any registered
LoggerEventListener . |
List |
getErrorList()
Errors which cannot be logged, go to the error list.
|
org.apache.log4j.spi.LoggerFactory |
getLoggerFactory()
Returns the logger factory used by
LoggerRepository.getLogger(String).
|
String |
getName()
Get the name of this logger repository.
|
Object |
getObject(String key)
A LoggerRepository can also act as a store for various objects used
by log4j components.
|
PluginRegistry |
getPluginRegistry()
Return the PluginRegisty for this LoggerRepository.
|
Map |
getProperties()
Get the properties specific for this repository.
|
String |
getProperty(String key)
Get the property of this repository.
|
Scheduler |
getScheduler()
Return the
Scheduler for this LoggerRepository. |
boolean |
isPristine()
Is the current configuration of the repository in its original (pristine)
state?
|
void |
putObject(String key,
Object value)
Store an object under 'key'.
|
void |
removeLoggerEventListener(LoggerEventListener listener)
Remove a
LoggerEventListener from the repository. |
void |
removeLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)
Remove a
LoggerRepositoryEventListener from the repository. |
void |
setLoggerFactory(org.apache.log4j.spi.LoggerFactory loggerFactory)
Sets the logger factory used by LoggerRepository.getLogger(String).
|
void |
setName(String repoName)
A logger repository is a named entity.
|
void |
setPristine(boolean state)
Set the pristine flag.
|
void |
setProperty(String key,
String value)
Set a property of this repository.
|
addHierarchyEventListener, emitNoAppenderWarning, exists, fireAddAppenderEvent, getCurrentCategories, getCurrentLoggers, getLogger, getLogger, getRootLogger, getThreshold, isDisabled, resetConfiguration, setThreshold, setThreshold, shutdown
void addLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)
LoggerRepositoryEventListener
to the repository. The
listener will be called when repository events occur.listener
- event listener, may not be null.void removeLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)
LoggerRepositoryEventListener
from the repository.listener
- listener.void addLoggerEventListener(LoggerEventListener listener)
LoggerEventListener
to the repository. The listener
will be called when repository events occur.listener
- listener, may not be null.void removeLoggerEventListener(LoggerEventListener listener)
LoggerEventListener
from the repository.listener
- listener, may not be null.String getName()
void setName(String repoName)
repoName
- new name, may not be null.boolean isPristine()
void setPristine(boolean state)
state
- stateisPristine()
void fireRemoveAppenderEvent(org.apache.log4j.Category logger, org.apache.log4j.Appender appender)
LoggerEventListener
.logger
- The logger from which the appender was removed.appender
- The appender removed from the logger.void fireLevelChangedEvent(org.apache.log4j.Logger logger)
LoggerEventListener
.logger
- The logger which changed levels.void fireConfigurationChangedEvent()
LoggerRepositoryEventListener
.PluginRegistry getPluginRegistry()
Scheduler getScheduler()
Scheduler
for this LoggerRepository.Map getProperties()
String getProperty(String key)
key
- property key.void setProperty(String key, String value)
key
- key, may not be null.value
- new value, if null, property will be removed.List getErrorList()
void addErrorItem(ErrorItem errorItem)
errorItem
- an ErrorItem to add to the error listObject getObject(String key)
key
- key, may not be null.void putObject(String key, Object value)
key
- key, may not be null.value
- value, may be null.void setLoggerFactory(org.apache.log4j.spi.LoggerFactory loggerFactory)
loggerFactory
- factory to use, may not be nullorg.apache.log4j.spi.LoggerFactory getLoggerFactory()
Copyright © 2002-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache Chainsaw, Chainsaw, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.