Package org.apache.logging.slf4j
Class Log4jLoggerFactory
- java.lang.Object
-
- org.apache.logging.log4j.spi.AbstractLoggerAdapter<org.slf4j.Logger>
-
- org.apache.logging.slf4j.Log4jLoggerFactory
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,LoggerAdapter<org.slf4j.Logger>,LoggerContextShutdownAware,org.slf4j.ILoggerFactory
public class Log4jLoggerFactory extends AbstractLoggerAdapter<org.slf4j.Logger> implements org.slf4j.ILoggerFactory
Log4j implementation of SLF4J ILoggerFactory interface.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.function.Predicate<java.lang.Class<?>>CALLER_PREDICATEprivate static StatusLoggerLOGGERprivate Log4jMarkerFactorymarkerFactoryprivate static java.lang.StringSLF4J_PACKAGEprivate static java.lang.StringTO_SLF4J_CONTEXT-
Fields inherited from class org.apache.logging.log4j.spi.AbstractLoggerAdapter
registry
-
-
Constructor Summary
Constructors Constructor Description Log4jLoggerFactory(Log4jMarkerFactory markerFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LoggerContextgetContext()Gets theLoggerContextthat should be used to look up or create loggers.(package private) Log4jMarkerFactorygetMarkerFactory()protected org.slf4j.LoggernewLogger(java.lang.String name, LoggerContext context)Creates a new named logger for a givenLoggerContext.private LoggerContextvalidateContext(LoggerContext context)-
Methods inherited from class org.apache.logging.log4j.spi.AbstractLoggerAdapter
close, contextShutdown, getContext, getLogger, getLoggerContexts, getLoggersInContext
-
-
-
-
Field Detail
-
LOGGER
private static final StatusLogger LOGGER
-
SLF4J_PACKAGE
private static final java.lang.String SLF4J_PACKAGE
- See Also:
- Constant Field Values
-
CALLER_PREDICATE
private static final java.util.function.Predicate<java.lang.Class<?>> CALLER_PREDICATE
-
TO_SLF4J_CONTEXT
private static final java.lang.String TO_SLF4J_CONTEXT
- See Also:
- Constant Field Values
-
markerFactory
private final Log4jMarkerFactory markerFactory
-
-
Constructor Detail
-
Log4jLoggerFactory
public Log4jLoggerFactory(Log4jMarkerFactory markerFactory)
-
-
Method Detail
-
newLogger
protected org.slf4j.Logger newLogger(java.lang.String name, LoggerContext context)Description copied from class:AbstractLoggerAdapterCreates a new named logger for a givenLoggerContext.- Specified by:
newLoggerin classAbstractLoggerAdapter<org.slf4j.Logger>- Parameters:
name- the name of the logger to createcontext- the LoggerContext this logger will be associated with- Returns:
- the new named logger
-
getContext
protected LoggerContext getContext()
Description copied from class:AbstractLoggerAdapterGets theLoggerContextthat should be used to look up or create loggers. This is similar in spirit to theContextSelectorclass inlog4j-core. However, implementations can rely on their own framework's separation of contexts instead (or simply use a singleton).- Specified by:
getContextin classAbstractLoggerAdapter<org.slf4j.Logger>- Returns:
- the LoggerContext to be used for lookup and creation purposes
- See Also:
LogManager.getContext(ClassLoader, boolean),LogManager.getContext(String, boolean)
-
getMarkerFactory
Log4jMarkerFactory getMarkerFactory()
-
validateContext
private LoggerContext validateContext(LoggerContext context)
-
-