Top Description Inners Constructors Methods
io.netty5.util.internal.logging

public abstract Class InternalLoggerFactory

extends Object
Class Inheritance
Known Direct Subclasses
io.netty5.util.internal.logging.JdkLoggerFactory, io.netty5.util.internal.logging.Log4J2LoggerFactory, io.netty5.util.internal.logging.Slf4JLoggerFactory, io.netty5.util.internal.logging.CommonsLoggerFactory
Imports
java.util.concurrent.atomic.AtomicReference

Creates InternalLoggers. This factory allows you to choose what logging framework Netty should use. The default factory is Slf4JLoggerFactory. 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 via setDefaultFactory(InternalLoggerFactory). If you want to change the logger factory, setDefaultFactory(InternalLoggerFactory) must be invoked before any other Netty classes are loaded. Note that setDefaultFactory(InternalLoggerFactory)} can not be invoked more than once.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static InternalLoggerFactory
getDefaultFactory()

Get the default factory that was either initialized automatically based on logging implementations on the classpath, or set explicitly via setDefaultFactory(InternalLoggerFactory).

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.

protected abstract InternalLogger
newInstance(String name)

Creates a new logger instance with the specified name.

public static void
setDefaultFactory(InternalLoggerFactory
a non-null implementation of InternalLoggerFactory
defaultFactory
)

Set the default factory.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

InternalLoggerFactoryback to summary
public InternalLoggerFactory()

Method Detail

getDefaultFactoryback to summary
public static InternalLoggerFactory getDefaultFactory()

Get the default factory that was either initialized automatically based on logging implementations on the classpath, or set explicitly via setDefaultFactory(InternalLoggerFactory).

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.

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)

Set the default factory. This method must be invoked before the default factory is initialized via getDefaultFactory(), and can not be invoked multiple times.

Parameters
defaultFactory:InternalLoggerFactory

a non-null implementation of InternalLoggerFactory

io.netty5.util.internal.logging back to summary

pack-priv final Class InternalLoggerFactory.InternalLoggerFactoryHolder

extends Object
Class Inheritance
  • java.lang.Object
  • io.netty5.util.internal.logging.InternalLoggerFactory.InternalLoggerFactoryHolder

This class holds a reference to the InternalLoggerFactory. The raison d'être for this class is primarily to aid in testing.

Field Summary

Modifier and TypeField and Description
pack-priv static final InternalLoggerFactory.InternalLoggerFactoryHolder
private final AtomicReference<InternalLoggerFactory>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv InternalLoggerFactory
pack-priv InternalLogger
getInstance(final Class<?> clazz)

pack-priv InternalLogger
getInstance(final String name)

private static InternalLoggerFactory
pack-priv InternalLogger
pack-priv void
private static InternalLoggerFactory
private static InternalLoggerFactory
private static InternalLoggerFactory
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HOLDERback to summary
pack-priv static final InternalLoggerFactory.InternalLoggerFactoryHolder HOLDER
referenceback to summary
private final AtomicReference<InternalLoggerFactory> reference

Constructor Detail

InternalLoggerFactoryHolderback to summary
pack-priv InternalLoggerFactoryHolder()
InternalLoggerFactoryHolderback to summary
pack-priv InternalLoggerFactoryHolder(final InternalLoggerFactory delegate)

Method Detail

getFactoryback to summary
pack-priv InternalLoggerFactory getFactory()
getInstanceback to summary
pack-priv InternalLogger getInstance(final Class<?> clazz)
getInstanceback to summary
pack-priv InternalLogger getInstance(final String name)
newDefaultFactoryback to summary
private static InternalLoggerFactory newDefaultFactory(String name)
newInstanceback to summary
pack-priv InternalLogger newInstance(String name)
setFactoryback to summary
pack-priv void setFactory(final InternalLoggerFactory factory)
useJdkLoggerFactoryback to summary
private static InternalLoggerFactory useJdkLoggerFactory(String name)
useLog4J2LoggerFactoryback to summary
private static InternalLoggerFactory useLog4J2LoggerFactory(String name)
useSlf4JLoggerFactoryback to summary
private static InternalLoggerFactory useSlf4JLoggerFactory(String name)