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.

    Author:
    Ceki Gülcü, Mark Womack, Curt Arnold
    • Method Detail

      • addLoggerEventListener

        void addLoggerEventListener​(LoggerEventListener listener)
        Add a LoggerEventListener to the repository. The listener will be called when repository events occur.
        Parameters:
        listener - listener, may not be null.
      • removeLoggerEventListener

        void removeLoggerEventListener​(LoggerEventListener listener)
        Remove a LoggerEventListener from the repository.
        Parameters:
        listener - listener, may not be null.
      • getName

        String getName()
        Get the name of this logger repository.
        Returns:
        name, may not be null.
      • setName

        void setName​(String repoName)
        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:
        isPristine()
      • fireRemoveAppenderEvent

        void fireRemoveAppenderEvent​(org.apache.log4j.Category logger,
                                     org.apache.log4j.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.
      • fireLevelChangedEvent

        void fireLevelChangedEvent​(org.apache.log4j.Logger logger)
        Requests that a level changed event be sent to any registered LoggerEventListener.
        Parameters:
        logger - The logger which changed levels.
      • fireConfigurationChangedEvent

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

        PluginRegistry getPluginRegistry()
        Return the PluginRegisty for this LoggerRepository.
        Returns:
        plug in registry.
      • getScheduler

        Scheduler getScheduler()
        Return the Scheduler for this LoggerRepository.
        Returns:
        scheduler.
      • getProperties

        Map<String,​String> getProperties()
        Get the properties specific for this repository.
        Returns:
        property map.
      • getProperty

        String getProperty​(String key)
        Get the property of this repository.
        Parameters:
        key - property key.
        Returns:
        key value or null if not set.
      • setProperty

        void setProperty​(String key,
                         String value)
        Set a property of this repository.
        Parameters:
        key - key, may not be null.
        value - new value, if null, property will be removed.
      • getErrorList

        List<ErrorItem> getErrorList()
        Errors which cannot be logged, go to the error list.
        Returns:
        List
      • addErrorItem

        void addErrorItem​(ErrorItem errorItem)
        Errors which cannot be logged, go to the error list.
        Parameters:
        errorItem - an ErrorItem to add to the error list
      • getObject

        Object getObject​(String key)
        A LoggerRepository can also act as a store for various objects used by log4j components.
        Parameters:
        key - key, may not be null.
        Returns:
        The object stored under 'key'.
      • putObject

        void putObject​(String key,
                       Object value)
        Store an object under 'key'. If no object can be found, null is returned.
        Parameters:
        key - key, may not be null.
        value - value, may be null.
      • 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