Top Description Fields Constructors Methods
io.netty.util.internal.logging

public abstract Class InternalLoggerFactory

extends Object
Class Inheritance
Known Direct Subclasses
io.netty.util.internal.logging.JdkLoggerFactory, io.netty.util.internal.logging.Log4J2LoggerFactory, io.netty.util.internal.logging.Log4JLoggerFactory, io.netty.util.internal.logging.Slf4JLoggerFactory, io.netty.util.internal.logging.CommonsLoggerFactory
Imports
io.netty.util.internal.ObjectUtil

Creates an InternalLogger or changes the default factory implementation. This factory allows you to choose what logging framework Netty should use. The default factory is Slf4JLoggerFactory. 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);
Please note that the new default factory is effective only for the classes which were loaded after the default factory is changed. Therefore, setDefaultFactory(InternalLoggerFactory) should be called as early as possible and shouldn't be called more than once.

Field Summary

Modifier and TypeField and Description
private static volatile InternalLoggerFactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static InternalLoggerFactory
getDefaultFactory()

Returns the default factory.

public static InternalLogger
getInstance(Class<?> clazz)

Creates a new logger instance with the name of the specified class.

public static InternalLogger
getInstance(String name)

Creates a new logger instance with the specified name.

private static InternalLoggerFactory
protected abstract InternalLogger
newInstance(String name)

Creates a new logger instance with the specified name.

public static void
setDefaultFactory(InternalLoggerFactory defaultFactory)

Changes the default factory.

private static InternalLoggerFactory
private static InternalLoggerFactory
private static InternalLoggerFactory
private static InternalLoggerFactory
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultFactoryback to summary
private static volatile InternalLoggerFactory defaultFactory

Constructor Detail

InternalLoggerFactoryback to summary
public InternalLoggerFactory()

Method Detail

getDefaultFactoryback to summary
public static InternalLoggerFactory getDefaultFactory()

Returns the default factory. The initial default factory is JdkLoggerFactory.

getInstanceback to summary
public static InternalLogger getInstance(Class<?> clazz)

Creates a new logger instance with the name of the specified class.

getInstanceback to summary
public static InternalLogger getInstance(String name)

Creates a new logger instance with the specified name.

newDefaultFactoryback to summary
private static InternalLoggerFactory newDefaultFactory(String name)
Annotations
@SuppressWarnings:UnusedCatchParameter
newInstanceback to summary
protected abstract InternalLogger newInstance(String name)

Creates a new logger instance with the specified name.

setDefaultFactoryback to summary
public static void setDefaultFactory(InternalLoggerFactory defaultFactory)

Changes the default factory.

useJdkLoggerFactoryback to summary
private static InternalLoggerFactory useJdkLoggerFactory(String name)
useLog4J2LoggerFactoryback to summary
private static InternalLoggerFactory useLog4J2LoggerFactory(String name)
useLog4JLoggerFactoryback to summary
private static InternalLoggerFactory useLog4JLoggerFactory(String name)
useSlf4JLoggerFactoryback to summary
private static InternalLoggerFactory useSlf4JLoggerFactory(String name)