org.apache.log4j.spi

## 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 Summary

    All Methods Instance Methods Abstract Methods
    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.

    - ### 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 Detail

    - #### addLoggerRepositoryEventListener

          void addLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)

      Add a `LoggerRepositoryEventListener` to the repository. The listener will be called when repository events occur.
      Parameters:
        `listener` - event listener, may not be null.

    - #### removeLoggerRepositoryEventListener

          void removeLoggerRepositoryEventListener(LoggerRepositoryEventListener listener)

      Remove a `LoggerRepositoryEventListener` from the repository.
      Parameters:
        `listener` - listener.

    - #### 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 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 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

Copyright © 2002-2018 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.