Home / Class/ Slf4JLoggerFactory Class — netty Architecture

Slf4JLoggerFactory Class — netty Architecture

Architecture documentation for the Slf4JLoggerFactory class in Slf4JLoggerFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6cce3611_3e01_2ae4_c010_841605c85ebb["Slf4JLoggerFactory"]
  16a29239_af04_21b3_104c_4aae854c3d6e["Slf4JLoggerFactory.java"]
  6cce3611_3e01_2ae4_c010_841605c85ebb -->|defined in| 16a29239_af04_21b3_104c_4aae854c3d6e
  804dd123_efdc_1c12_009f_7f024d9e7f07["Slf4JLoggerFactory()"]
  6cce3611_3e01_2ae4_c010_841605c85ebb -->|method| 804dd123_efdc_1c12_009f_7f024d9e7f07
  dade0e3f_0613_e1ae_b5d7_0de680010348["InternalLogger()"]
  6cce3611_3e01_2ae4_c010_841605c85ebb -->|method| dade0e3f_0613_e1ae_b5d7_0de680010348
  b89b9a80_7c48_1c5d_0ca9_0e340647bc46["InternalLoggerFactory()"]
  6cce3611_3e01_2ae4_c010_841605c85ebb -->|method| b89b9a80_7c48_1c5d_0ca9_0e340647bc46

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/logging/Slf4JLoggerFactory.java lines 28–65

public class Slf4JLoggerFactory extends InternalLoggerFactory {

    @SuppressWarnings("deprecation")
    public static final InternalLoggerFactory INSTANCE = new Slf4JLoggerFactory();

    /**
     * @deprecated Use {@link #INSTANCE} instead.
     */
    @Deprecated
    public Slf4JLoggerFactory() {
    }

    Slf4JLoggerFactory(boolean failIfNOP) {
        assert failIfNOP; // Should be always called with true.
        if (LoggerFactory.getILoggerFactory() instanceof NOPLoggerFactory) {
            throw new NoClassDefFoundError("NOPLoggerFactory not supported");
        }
    }

    @Override
    public InternalLogger newInstance(String name) {
        return wrapLogger(LoggerFactory.getLogger(name));
    }

    // package-private for testing.
    static InternalLogger wrapLogger(Logger logger) {
        return logger instanceof LocationAwareLogger ?
                new LocationAwareSlf4JLogger((LocationAwareLogger) logger) : new Slf4JLogger(logger);
    }

    static InternalLoggerFactory getInstanceWithNopCheck() {
        return NopInstanceHolder.INSTANCE_WITH_NOP_CHECK;
    }

    private static final class NopInstanceHolder {
        private static final InternalLoggerFactory INSTANCE_WITH_NOP_CHECK = new Slf4JLoggerFactory(true);
    }
}

Frequently Asked Questions

What is the Slf4JLoggerFactory class?
Slf4JLoggerFactory is a class in the netty codebase, defined in common/src/main/java/io/netty/util/internal/logging/Slf4JLoggerFactory.java.
Where is Slf4JLoggerFactory defined?
Slf4JLoggerFactory is defined in common/src/main/java/io/netty/util/internal/logging/Slf4JLoggerFactory.java at line 28.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free