Log4j 1.3alpha-1

org.apache.log4j.spi
Interface LoggerRepository

All Known Implementing Classes:
Hierarchy

public interface 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.

Since:
1.2
Author:
Ceki Gülcü, Mark Womack

Method Summary
 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 emitNoAppenderWarning(Logger logger)
           
 Logger exists(java.lang.String name)
           
 void fireAddAppenderEvent(Logger logger, Appender appender)
          Requests that a appender added event be sent to any registered LoggerEventListener.
 void fireConfigurationChangedEvent()
          Requests that a configuration changed event be sent to any registered LoggerRepositoryEventListener.
 void fireLevelChangedEvent(Logger logger)
          Requests that a level changed event be sent to any registered LoggerEventListener.
 void fireRemoveAppenderEvent(Logger logger, Appender appender)
          Requests that a appender removed event be sent to any registered LoggerEventListener.
 java.util.Enumeration getCurrentCategories()
          Deprecated. Please use getCurrentLoggers() instead.
 java.util.Enumeration getCurrentLoggers()
           
 java.util.List getErrorList()
          Errors which cannot be logged, go to the error list,
 Logger getLogger(java.lang.String name)
           
 Logger getLogger(java.lang.String name, LoggerFactory factory)
           
 java.lang.String getName()
          Get the name of this logger repository.
 PluginRegistry getPluginRegistry()
          Return the PluginRegisty for this LoggerRepository.
 java.util.Map getProperties()
          Get the properties specific for this repository.
 java.lang.String getProperty(java.lang.String key)
          Get the property of this repository.
 Logger getRootLogger()
           
 Level getThreshold()
          Get the repository-wide threshold.
 boolean isDisabled(int level)
          Is the repository disabled for a given level?
 boolean isPristine()
          Is the current configuration of the reposiroty in its original (pristine) state?
 void removeLoggerEventListener(LoggerEventListener listener)
          Remove a LoggerEventListener from the repository.
 void removeLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)
          Remove a LoggerRepositoryEventListener from the repository.
 void resetConfiguration()
           
 void setName(java.lang.String repoName)
          A logger repository is a named entity.
 void setPristine(boolean state)
          Set the pristine flag.
 void setProperty(java.lang.String key, java.lang.String value)
          Set a property of this repository.
 void setThreshold(Level level)
          Deprecated. Will be removed with no replacement.
 void setThreshold(java.lang.String val)
          Another form of setThreshold(Level) accepting a string parameter instead of a Level.
 void shutdown()
           
 

Method Detail

addLoggerRepositoryEventListener

public void addLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)
Add a LoggerRepositoryEventListener to the repository. The listener will be called when repository events occur.

Since:
1.3

removeLoggerRepositoryEventListener

public void removeLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)
Remove a LoggerRepositoryEventListener from the repository.

Since:
1.3

addLoggerEventListener

public void addLoggerEventListener(LoggerEventListener listener)
Add a LoggerEventListener to the repository. The listener will be called when repository events occur.

Since:
1.3

removeLoggerEventListener

public void removeLoggerEventListener(LoggerEventListener listener)
Remove a LoggerEventListener from the repository.

Since:
1.3

isDisabled

public boolean isDisabled(int level)
Is the repository disabled for a given level? The answer depends on the repository threshold and the level parameter. See also setThreshold(org.apache.log4j.Level) method.


getName

public java.lang.String getName()
Get the name of this logger repository.

Since:
1.3

setName

public void setName(java.lang.String repoName)
A logger repository is a named entity.

Since:
1.3

setThreshold

public void setThreshold(Level level)
Deprecated. Will be removed with no replacement.

Set the repository-wide threshold. All logging requests below the threshold are immediately dropped. By default, the threshold is set to Level.ALL which has the lowest possible rank.

The repository-wide threshold acts as a global on off switch. It avoids the hierarchy walk, hence improving performance. In future log4j versions the speed of the hiearchy walk will be significantly improved obliviating the need for this method.

The repository-wide threshold is a deprecated feature.


setThreshold

public void setThreshold(java.lang.String val)
Another form of setThreshold(Level) accepting a string parameter instead of a Level.


emitNoAppenderWarning

public void emitNoAppenderWarning(Logger logger)

getThreshold

public Level getThreshold()
Get the repository-wide threshold. See setThreshold(Level) for an explanation.


getLogger

public Logger getLogger(java.lang.String name)

getLogger

public Logger getLogger(java.lang.String name,
                        LoggerFactory factory)

getRootLogger

public Logger getRootLogger()

isPristine

public boolean isPristine()
Is the current configuration of the reposiroty in its original (pristine) state?

Since:
1.3

setPristine

public void setPristine(boolean state)
Set the pristine flag.

Since:
1.3
See Also:
isPristine()

exists

public Logger exists(java.lang.String name)

shutdown

public void shutdown()

getCurrentLoggers

public java.util.Enumeration getCurrentLoggers()

getCurrentCategories

public java.util.Enumeration getCurrentCategories()
Deprecated. Please use getCurrentLoggers() instead.


resetConfiguration

public void resetConfiguration()

fireAddAppenderEvent

public void fireAddAppenderEvent(Logger logger,
                                 Appender appender)
Requests that a appender added event be sent to any registered LoggerEventListener.

Parameters:
logger - The logger to which the appender was added.
appender - The appender added to the logger.
Since:
1.3

fireRemoveAppenderEvent

public void fireRemoveAppenderEvent(Logger logger,
                                    Appender appender)
Requests that a appender removed event be sent to any registered LoggerEventListener.

Parameters:
logger - The logger from which the appender was removed.
appender - The appender removed from the logger.
Since:
1.3

fireLevelChangedEvent

public void fireLevelChangedEvent(Logger logger)
Requests that a level changed event be sent to any registered LoggerEventListener.

Parameters:
logger - The logger which changed levels.
Since:
1.3

fireConfigurationChangedEvent

public void fireConfigurationChangedEvent()
Requests that a configuration changed event be sent to any registered LoggerRepositoryEventListener.

Since:
1.3

getPluginRegistry

public PluginRegistry getPluginRegistry()
Return the PluginRegisty for this LoggerRepository.

Since:
1.3

getProperties

public java.util.Map getProperties()
Get the properties specific for this repository.

Since:
1.3

getProperty

public java.lang.String getProperty(java.lang.String key)
Get the property of this repository.

Since:
1.3

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Set a property of this repository.

Since:
1.3

getErrorList

public java.util.List getErrorList()
Errors which cannot be logged, go to the error list,

Returns:
List

addErrorItem

public void addErrorItem(ErrorItem errorItem)
Errors which cannot be logged, go to the error list,

Returns:
List

Log4j 1.3alpha-1

Copyright 2000-2003 Apache Software Foundation.