|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.LogManager
public class LogManager
The anchor point for the logging system.
Field Summary | |
---|---|
static String |
ROOT_LOGGER_NAME
The name of the root Logger. |
Constructor Summary | |
---|---|
protected |
LogManager()
Prevents instantiation |
Method Summary | |
---|---|
static LoggerContext |
getContext()
Returns the current LoggerContext. |
static LoggerContext |
getContext(boolean currentContext)
Returns a LoggerContext. |
static LoggerContext |
getContext(ClassLoader loader,
boolean currentContext)
Returns a LoggerContext. |
static LoggerContext |
getContext(ClassLoader loader,
boolean currentContext,
URI configLocation)
Returns a LoggerContext. |
protected static LoggerContext |
getContext(String fqcn,
boolean currentContext)
Returns a LoggerContext |
protected static LoggerContext |
getContext(String fqcn,
ClassLoader loader,
boolean currentContext)
Returns a LoggerContext |
static LoggerContextFactory |
getFactory()
Returns the LoggerContextFactory. |
static Logger |
getFormatterLogger(Class<?> clazz)
Returns a formatter Logger using the fully qualified name of the Class as the Logger name. |
static Logger |
getFormatterLogger(Object value)
Returns a formatter Logger using the fully qualified name of the value's Class as the Logger name. |
static Logger |
getFormatterLogger(String name)
Returns a formatter Logger with the specified name. |
static Logger |
getLogger(Class<?> clazz)
Returns a Logger using the fully qualified name of the Class as the Logger name. |
static Logger |
getLogger(Class<?> clazz,
MessageFactory messageFactory)
Returns a Logger using the fully qualified name of the Class as the Logger name. |
static Logger |
getLogger(Object value)
Returns a Logger using the fully qualified class name of the value as the Logger name. |
static Logger |
getLogger(Object value,
MessageFactory messageFactory)
Returns a Logger using the fully qualified class name of the value as the Logger name. |
static Logger |
getLogger(String name)
Returns a Logger with the specified name. |
static Logger |
getLogger(String name,
MessageFactory messageFactory)
Returns a Logger with the specified name. |
protected static Logger |
getLogger(String fqcn,
String name)
Returns a Logger with the specified name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ROOT_LOGGER_NAME
Constructor Detail |
---|
protected LogManager()
Method Detail |
---|
public static LoggerContext getContext()
WARNING - The LoggerContext returned by this method may not be the LoggerContext used to create a Logger for the calling class.
public static LoggerContext getContext(boolean currentContext)
currentContext
- if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may be
returned. If true then only a single LoggerContext will be returned.
public static LoggerContext getContext(ClassLoader loader, boolean currentContext)
loader
- The ClassLoader for the context. If null the context will attempt to determine the appropriate
ClassLoader.currentContext
- if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may be
returned. If true then only a single LoggerContext will be returned.
public static LoggerContext getContext(ClassLoader loader, boolean currentContext, URI configLocation)
loader
- The ClassLoader for the context. If null the context will attempt to determine the appropriate
ClassLoader.currentContext
- if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may be
returned. If true then only a single LoggerContext will be returned.configLocation
- The URI for the configuration to use.
protected static LoggerContext getContext(String fqcn, boolean currentContext)
fqcn
- The fully qualified class name of the Class that this method is a member of.currentContext
- if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may be
returned. If true then only a single LoggerContext will be returned.
protected static LoggerContext getContext(String fqcn, ClassLoader loader, boolean currentContext)
fqcn
- The fully qualified class name of the Class that this method is a member of.loader
- The ClassLoader for the context. If null the context will attempt to determine the appropriate
ClassLoader.currentContext
- if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may be
returned. If true then only a single LoggerContext will be returned.
public static LoggerContextFactory getFactory()
public static Logger getFormatterLogger(Class<?> clazz)
This logger let you use a Formatter
string in the message to format parameters.
Short-hand for getLogger(clazz, StringFormatterMessageFactory.INSTANCE)
clazz
- The Class whose name should be used as the Logger name.
StringFormatterMessageFactory
Logger.fatal(Marker, String, Object...)
,
Logger.fatal(String, Object...)
,
Logger.error(Marker, String, Object...)
,
Logger.error(String, Object...)
,
Logger.warn(Marker, String, Object...)
,
Logger.warn(String, Object...)
,
Logger.info(Marker, String, Object...)
,
Logger.info(String, Object...)
,
Logger.debug(Marker, String, Object...)
,
Logger.debug(String, Object...)
,
Logger.trace(Marker, String, Object...)
,
Logger.trace(String, Object...)
,
StringFormatterMessageFactory
public static Logger getFormatterLogger(Object value)
This logger let you use a Formatter
string in the message to format parameters.
Short-hand for getLogger(value, StringFormatterMessageFactory.INSTANCE)
value
- The value's whose class name should be used as the Logger name.
StringFormatterMessageFactory
Logger.fatal(Marker, String, Object...)
,
Logger.fatal(String, Object...)
,
Logger.error(Marker, String, Object...)
,
Logger.error(String, Object...)
,
Logger.warn(Marker, String, Object...)
,
Logger.warn(String, Object...)
,
Logger.info(Marker, String, Object...)
,
Logger.info(String, Object...)
,
Logger.debug(Marker, String, Object...)
,
Logger.debug(String, Object...)
,
Logger.trace(Marker, String, Object...)
,
Logger.trace(String, Object...)
,
StringFormatterMessageFactory
public static Logger getFormatterLogger(String name)
This logger let you use a Formatter
string in the message to format parameters.
Short-hand for getLogger(name, StringFormatterMessageFactory.INSTANCE)
name
- The logger name.
StringFormatterMessageFactory
Logger.fatal(Marker, String, Object...)
,
Logger.fatal(String, Object...)
,
Logger.error(Marker, String, Object...)
,
Logger.error(String, Object...)
,
Logger.warn(Marker, String, Object...)
,
Logger.warn(String, Object...)
,
Logger.info(Marker, String, Object...)
,
Logger.info(String, Object...)
,
Logger.debug(Marker, String, Object...)
,
Logger.debug(String, Object...)
,
Logger.trace(Marker, String, Object...)
,
Logger.trace(String, Object...)
,
StringFormatterMessageFactory
public static Logger getLogger(Class<?> clazz)
clazz
- The Class whose name should be used as the Logger name.
public static Logger getLogger(Class<?> clazz, MessageFactory messageFactory)
clazz
- The Class whose name should be used as the Logger name.messageFactory
- The message factory is used only when creating a logger, subsequent use does not change
the logger but will log a warning if mismatched.
public static Logger getLogger(Object value)
value
- The value whose class name should be used as the Logger name.
public static Logger getLogger(Object value, MessageFactory messageFactory)
value
- The value whose class name should be used as the Logger name.messageFactory
- The message factory is used only when creating a logger, subsequent use does not change
the logger but will log a warning if mismatched.
public static Logger getLogger(String name)
name
- The logger name.
public static Logger getLogger(String name, MessageFactory messageFactory)
name
- The logger name.messageFactory
- The message factory is used only when creating a logger, subsequent use does not change
the logger but will log a warning if mismatched.
protected static Logger getLogger(String fqcn, String name)
fqcn
- The fully qualified class name of the class that this method is a member of.name
- The logger name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2013 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.