Package org.apache.log4j
Class LogManager
- java.lang.Object
-
- org.apache.log4j.LogManager
-
public class LogManager extends Object
In pax-logging-api, this class is part of Log4j1 API, but it doesn't perform any discovery. It can be used to access some internal information from Log4j1. Use theLogManagerclass to retreiveLoggerinstances or to operate on the currentLoggerRepository. When theLogManagerclass 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
Fields Modifier and Type Field Description static StringCONFIGURATOR_CLASS_KEYDeprecated.This variable is for internal use only.static StringDEFAULT_CONFIGURATION_FILEDeprecated.This variable is for internal use only.static StringDEFAULT_CONFIGURATION_KEYDeprecated.This variable is for internal use only.static StringDEFAULT_INIT_OVERRIDE_KEYDeprecated.This variable is for internal use only.
-
Constructor Summary
Constructors Constructor Description LogManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Loggerexists(String name)static EnumerationgetCurrentLoggers()static LoggergetLogger(Class clazz)Retrieve the appropriateLoggerinstance.static LoggergetLogger(String name)Retrieve the appropriateLoggerinstance.static LoggergetLogger(String name, org.apache.log4j.spi.LoggerFactory factory)Retrieve the appropriateLoggerinstance.static org.apache.log4j.spi.LoggerRepositorygetLoggerRepository()static LoggergetRootLogger()Retrieve the appropriate root logger.static voidresetConfiguration()static voidsetRepositorySelector(org.apache.log4j.spi.RepositorySelector selector, Object guard)SetsLoggerFactorybut only if the correct guard is passed as parameter.static voidshutdown()
-
-
-
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
-
-
Method Detail
-
setRepositorySelector
public static void setRepositorySelector(org.apache.log4j.spi.RepositorySelector selector, Object guard) throws IllegalArgumentExceptionSetsLoggerFactorybut 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 aIllegalArgumentException, unless the previously setguardis passed as the second parameter.This allows a high-level component to set the
RepositorySelectorused by theLogManager.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 org.apache.log4j.spi.LoggerRepository getLoggerRepository()
-
getRootLogger
public static Logger getRootLogger()
Retrieve the appropriate root logger.
-
getLogger
public static Logger getLogger(String name, org.apache.log4j.spi.LoggerFactory factory)
Retrieve the appropriateLoggerinstance.
-
getCurrentLoggers
public static Enumeration getCurrentLoggers()
-
shutdown
public static void shutdown()
-
resetConfiguration
public static void resetConfiguration()
-
-