## org.apache.log4j
Class LogManager

    java.lang.Object
      org.apache.log4j.LogManager

    public class LogManager

extends Object

Use the `LogManager` class to retreive `Logger` instances or to operate on the current `LoggerRepository`. When the `LogManager` class is loaded into memory the default initalzation procedure is inititated. The default intialization procedure is described in the short log4j manual.

Author:
  Ceki Gülcü

Field Summary
`static String` `CONFIGURATOR_CLASS_KEY` Deprecated. This variable is for internal use only. It will become private in future versions.
`static String` `DEFAULT_CONFIGURATION_FILE` Deprecated. This variable is for internal use only. It will become package protected in future versions.
`static String` `DEFAULT_CONFIGURATION_KEY` Deprecated. This variable is for internal use only. It will become private in future versions.
`static String` `DEFAULT_INIT_OVERRIDE_KEY` Deprecated. This variable is for internal use only. It will become private in future versions.

Constructor Summary
`LogManager()`

Method Summary
`static Logger` `exists(String name)`
`static Enumeration` `getCurrentLoggers()`
`static Logger` `getLogger(Class clazz)` Retrieve the appropriate `Logger` instance.
`static Logger` `getLogger(String name)` Retrieve the appropriate `Logger` instance.
`static Logger` `getLogger(String name, LoggerFactory factory)` Retrieve the appropriate `Logger` instance.
`static LoggerRepository` `getLoggerRepository()`
`static Logger` `getRootLogger()` Retrieve the appropriate root logger.
`static void` `resetConfiguration()`
`static void` `setRepositorySelector(RepositorySelector selector, Object guard)` Sets `LoggerFactory` but only if the correct guard is passed as parameter.
`static void` `shutdown()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_CONFIGURATION_FILE

    public static final String DEFAULT_CONFIGURATION_FILE

  Deprecated. This variable is for internal use only. It will become package protected in future versions.
  See Also:
    Constant Field Values

### DEFAULT_CONFIGURATION_KEY

    public static final String DEFAULT_CONFIGURATION_KEY

  Deprecated. This variable is for internal use only. It will become private in future versions.
  See Also:
    Constant Field Values

### CONFIGURATOR_CLASS_KEY

    public static final String CONFIGURATOR_CLASS_KEY

  Deprecated. This variable is for internal use only. It will become private in future versions.
  See Also:
    Constant Field Values

### DEFAULT_INIT_OVERRIDE_KEY

    public static final String DEFAULT_INIT_OVERRIDE_KEY

  Deprecated. This variable is for internal use only. It will become private in future versions.
  See Also:
    Constant Field Values

Constructor Detail

### LogManager

    public LogManager()

Method Detail

### setRepositorySelector

    public static void setRepositorySelector(RepositorySelector selector,
                                             Object guard)
                                      throws IllegalArgumentException

  Sets `LoggerFactory` but only if the correct guard is passed as parameter.

  Initally the guard is null. If the guard is `null`, then invoking this method sets the logger factory and the guard. Following invocations will throw a `IllegalArgumentException`, unless the previously set `guard` is passed as the second parameter.

  This allows a high-level component to set the `RepositorySelector` used by the `LogManager`.

  For example, when tomcat starts it will be able to install its own repository selector. However, if and when Tomcat is embedded within JBoss, then JBoss will install its own repository selector and Tomcat will use the repository selector set by its container, JBoss.

  Throws:
    `IllegalArgumentException`

### getLoggerRepository

    public static LoggerRepository getLoggerRepository()

### getRootLogger

    public static Logger getRootLogger()

  Retrieve the appropriate root logger.

### getLogger

    public static Logger getLogger(String name)

  Retrieve the appropriate `Logger` instance.

### getLogger

    public static Logger getLogger(Class clazz)

  Retrieve the appropriate `Logger` instance.

### getLogger

    public static Logger getLogger(String name,
                                   LoggerFactory factory)

  Retrieve the appropriate `Logger` instance.

### exists

    public static Logger exists(String name)

### getCurrentLoggers

    public static Enumeration getCurrentLoggers()

### shutdown

    public static void shutdown()

### resetConfiguration

    public static void resetConfiguration()

Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.