- java.lang.Object
-
- io.netty5.util.internal.logging.InternalLoggerFactory
-
- Direct Known Subclasses:
CommonsLoggerFactory
,JdkLoggerFactory
,Log4J2LoggerFactory
,Slf4JLoggerFactory
public abstract class InternalLoggerFactory extends Object
CreatesInternalLogger
s. This factory allows you to choose what logging framework Netty should use. The default factory isSlf4JLoggerFactory
. If SLF4J is not available,Log4J2LoggerFactory
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 viasetDefaultFactory(InternalLoggerFactory)
. If you want to change the logger factory,setDefaultFactory(InternalLoggerFactory)
must be invoked before any other Netty classes are loaded. Note thatsetDefaultFactory(InternalLoggerFactory)
} can not be invoked more than once.
-
-
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()
Get the default factory that was either initialized automatically based on logging implementations on the classpath, or set explicitly viasetDefaultFactory(InternalLoggerFactory)
.static InternalLogger
getInstance(Class<?> clazz)
Creates a new logger instance with the name of the specified class.static InternalLogger
getInstance(String name)
Creates a new logger instance with the specified name.protected abstract InternalLogger
newInstance(String name)
Creates a new logger instance with the specified name.static void
setDefaultFactory(InternalLoggerFactory defaultFactory)
Set the default factory.
-
-
-
Method Detail
-
getDefaultFactory
public static InternalLoggerFactory getDefaultFactory()
Get the default factory that was either initialized automatically based on logging implementations on the classpath, or set explicitly viasetDefaultFactory(InternalLoggerFactory)
.
-
setDefaultFactory
public static void setDefaultFactory(InternalLoggerFactory defaultFactory)
Set the default factory. This method must be invoked before the default factory is initialized viagetDefaultFactory()
, and can not be invoked multiple times.- Parameters:
defaultFactory
- a non-null implementation ofInternalLoggerFactory
-
getInstance
public static InternalLogger getInstance(Class<?> clazz)
Creates a new logger instance with the name of the specified class.
-
getInstance
public static InternalLogger getInstance(String name)
Creates a new logger instance with the specified name.
-
newInstance
protected abstract InternalLogger newInstance(String name)
Creates a new logger instance with the specified name.
-
-