Package io.netty.util.internal.logging
Class InternalLoggerFactory
- java.lang.Object
-
- io.netty.util.internal.logging.InternalLoggerFactory
-
- Direct Known Subclasses:
CommonsLoggerFactory
,JdkLoggerFactory
,Log4J2LoggerFactory
,Log4JLoggerFactory
,Slf4JLoggerFactory
public abstract class InternalLoggerFactory extends java.lang.Object
Creates anInternalLogger
or changes the default factory implementation. This factory allows you to choose what logging framework Netty should use. The default factory isSlf4JLoggerFactory
. If SLF4J is not available,Log4JLoggerFactory
is used. If Log4J is not available,JdkLoggerFactory
is used. You can change it to your preferred logging framework before other Netty classes are loaded:InternalLoggerFactory
.setDefaultFactory(Log4JLoggerFactory
.INSTANCE);setDefaultFactory(InternalLoggerFactory)
should be called as early as possible and shouldn't be called more than once.
-
-
Field Summary
Fields Modifier and Type Field Description private static InternalLoggerFactory
defaultFactory
-
Constructor Summary
Constructors Constructor Description InternalLoggerFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static InternalLoggerFactory
getDefaultFactory()
Returns the default factory.static InternalLogger
getInstance(java.lang.Class<?> clazz)
Creates a new logger instance with the name of the specified class.static InternalLogger
getInstance(java.lang.String name)
Creates a new logger instance with the specified name.private static InternalLoggerFactory
newDefaultFactory(java.lang.String name)
protected abstract InternalLogger
newInstance(java.lang.String name)
Creates a new logger instance with the specified name.static void
setDefaultFactory(InternalLoggerFactory defaultFactory)
Changes the default factory.private static InternalLoggerFactory
useJdkLoggerFactory(java.lang.String name)
private static InternalLoggerFactory
useLog4J2LoggerFactory(java.lang.String name)
private static InternalLoggerFactory
useLog4JLoggerFactory(java.lang.String name)
private static InternalLoggerFactory
useSlf4JLoggerFactory(java.lang.String name)
-
-
-
Field Detail
-
defaultFactory
private static volatile InternalLoggerFactory defaultFactory
-
-
Method Detail
-
newDefaultFactory
private static InternalLoggerFactory newDefaultFactory(java.lang.String name)
-
useSlf4JLoggerFactory
private static InternalLoggerFactory useSlf4JLoggerFactory(java.lang.String name)
-
useLog4J2LoggerFactory
private static InternalLoggerFactory useLog4J2LoggerFactory(java.lang.String name)
-
useLog4JLoggerFactory
private static InternalLoggerFactory useLog4JLoggerFactory(java.lang.String name)
-
useJdkLoggerFactory
private static InternalLoggerFactory useJdkLoggerFactory(java.lang.String name)
-
getDefaultFactory
public static InternalLoggerFactory getDefaultFactory()
Returns the default factory. The initial default factory isJdkLoggerFactory
.
-
setDefaultFactory
public static void setDefaultFactory(InternalLoggerFactory defaultFactory)
Changes the default factory.
-
getInstance
public static InternalLogger getInstance(java.lang.Class<?> clazz)
Creates a new logger instance with the name of the specified class.
-
getInstance
public static InternalLogger getInstance(java.lang.String name)
Creates a new logger instance with the specified name.
-
newInstance
protected abstract InternalLogger newInstance(java.lang.String name)
Creates a new logger instance with the specified name.
-
-