Interface LoggerRepositoryEx
- All Superinterfaces:
org.apache.log4j.spi.LoggerRepository
- All Known Implementing Classes:
LoggerRepositoryExImpl
public interface LoggerRepositoryEx
extends org.apache.log4j.spi.LoggerRepository
A
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorItem(ErrorItem errorItem) Errors which cannot be logged, go to the error list.voidaddLoggerEventListener(LoggerEventListener listener) Add aLoggerEventListenerto the repository.voidAdd aLoggerRepositoryEventListenerto the repository.voidRequests that a configuration changed event be sent to any registeredLoggerRepositoryEventListener.voidfireLevelChangedEvent(org.apache.log4j.Logger logger) Requests that a level changed event be sent to any registeredLoggerEventListener.voidfireRemoveAppenderEvent(org.apache.log4j.Category logger, org.apache.log4j.Appender appender) Requests that a appender removed event be sent to any registeredLoggerEventListener.Errors which cannot be logged, go to the error list.org.apache.log4j.spi.LoggerFactoryReturns the logger factory used by LoggerRepository.getLogger(String).getName()Get the name of this logger repository.A LoggerRepository can also act as a store for various objects used by log4j components.Return the PluginRegisty for this LoggerRepository.Get the properties specific for this repository.getProperty(String key) Get the property of this repository.Return theSchedulerfor this LoggerRepository.booleanIs the current configuration of the repository in its original (pristine) state?voidStore an object under 'key'.voidremoveLoggerEventListener(LoggerEventListener listener) Remove aLoggerEventListenerfrom the repository.voidRemove aLoggerRepositoryEventListenerfrom the repository.voidsetLoggerFactory(org.apache.log4j.spi.LoggerFactory loggerFactory) Sets the logger factory used by LoggerRepository.getLogger(String).voidA logger repository is a named entity.voidsetPristine(boolean state) Set the pristine flag.voidsetProperty(String key, String value) Set a property of this repository.Methods inherited from interface org.apache.log4j.spi.LoggerRepository
addHierarchyEventListener, emitNoAppenderWarning, exists, fireAddAppenderEvent, getCurrentCategories, getCurrentLoggers, getLogger, getLogger, getRootLogger, getThreshold, isDisabled, resetConfiguration, setThreshold, setThreshold, shutdown
-
Method Details
-
addLoggerRepositoryEventListener
Add aLoggerRepositoryEventListenerto the repository. The listener will be called when repository events occur.- Parameters:
listener- event listener, may not be null.
-
removeLoggerRepositoryEventListener
Remove aLoggerRepositoryEventListenerfrom the repository.- Parameters:
listener- listener.
-
addLoggerEventListener
Add aLoggerEventListenerto the repository. The listener will be called when repository events occur.- Parameters:
listener- listener, may not be null.
-
removeLoggerEventListener
Remove aLoggerEventListenerfrom the repository.- Parameters:
listener- listener, may not be null.
-
getName
-
setName
A logger repository is a named entity.- Parameters:
repoName- new name, may not be null.
-
isPristine
boolean isPristine()Is the current configuration of the repository in its original (pristine) state?- Returns:
- true if repository is in original state.
-
setPristine
void setPristine(boolean state) Set the pristine flag.- Parameters:
state- state- See Also:
-
fireRemoveAppenderEvent
void fireRemoveAppenderEvent(org.apache.log4j.Category logger, org.apache.log4j.Appender appender) Requests that a appender removed event be sent to any registeredLoggerEventListener.- Parameters:
logger- The logger from which the appender was removed.appender- The appender removed from the logger.
-
fireLevelChangedEvent
void fireLevelChangedEvent(org.apache.log4j.Logger logger) Requests that a level changed event be sent to any registeredLoggerEventListener.- Parameters:
logger- The logger which changed levels.
-
fireConfigurationChangedEvent
void fireConfigurationChangedEvent()Requests that a configuration changed event be sent to any registeredLoggerRepositoryEventListener. -
getPluginRegistry
PluginRegistry getPluginRegistry()Return the PluginRegisty for this LoggerRepository.- Returns:
- plug in registry.
-
getScheduler
-
getProperties
-
getProperty
-
setProperty
-
getErrorList
-
addErrorItem
Errors which cannot be logged, go to the error list.- Parameters:
errorItem- an ErrorItem to add to the error list
-
getObject
-
putObject
-
setLoggerFactory
void setLoggerFactory(org.apache.log4j.spi.LoggerFactory loggerFactory) Sets the logger factory used by LoggerRepository.getLogger(String).- Parameters:
loggerFactory- factory to use, may not be null
-
getLoggerFactory
org.apache.log4j.spi.LoggerFactory getLoggerFactory()Returns the logger factory used by LoggerRepository.getLogger(String).- Returns:
- non-null factory
-