- java.lang.Object
-
- io.netty5.util.internal.logging.InternalLoggerFactory
-
- Direct Known Subclasses:
CommonsLoggerFactory,JdkLoggerFactory,Log4J2LoggerFactory,Slf4JLoggerFactory
public abstract class InternalLoggerFactory extends Object
CreatesInternalLoggers. This factory allows you to choose what logging framework Netty should use. The default factory isSlf4JLoggerFactory. If SLF4J is not available,Log4J2LoggerFactoryis used. If Log4J is not available,JdkLoggerFactoryis 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 InternalLoggerFactorygetDefaultFactory()Get the default factory that was either initialized automatically based on logging implementations on the classpath, or set explicitly viasetDefaultFactory(InternalLoggerFactory).static InternalLoggergetInstance(Class<?> clazz)Creates a new logger instance with the name of the specified class.static InternalLoggergetInstance(String name)Creates a new logger instance with the specified name.protected abstract InternalLoggernewInstance(String name)Creates a new logger instance with the specified name.static voidsetDefaultFactory(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.
-
-