Home / Class/ InternalLoggerFactory Class — netty Architecture

InternalLoggerFactory Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  e1d671b6_dc94_ad78_5802_df52e48e69b9["InternalLoggerFactory"]
  b54bb828_57e7_588a_eed6_afb9b3594c7a["InternalLoggerFactory.java"]
  e1d671b6_dc94_ad78_5802_df52e48e69b9 -->|defined in| b54bb828_57e7_588a_eed6_afb9b3594c7a
  076e88fc_2928_5717_614a_4831f95abc43["InternalLoggerFactory()"]
  e1d671b6_dc94_ad78_5802_df52e48e69b9 -->|method| 076e88fc_2928_5717_614a_4831f95abc43
  52db5038_03bf_0235_7e2f_0e2492ada436["setDefaultFactory()"]
  e1d671b6_dc94_ad78_5802_df52e48e69b9 -->|method| 52db5038_03bf_0235_7e2f_0e2492ada436
  a2fb69e7_fbd3_a68e_9a2d_e44ca736bf65["InternalLogger()"]
  e1d671b6_dc94_ad78_5802_df52e48e69b9 -->|method| a2fb69e7_fbd3_a68e_9a2d_e44ca736bf65

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/logging/InternalLoggerFactory.java lines 36–142

public abstract class InternalLoggerFactory {

    private static volatile InternalLoggerFactory defaultFactory;

    @SuppressWarnings("UnusedCatchParameter")
    private static InternalLoggerFactory newDefaultFactory(String name) {
        InternalLoggerFactory f = useSlf4JLoggerFactory(name);
        if (f != null) {
            return f;
        }

        f = useLog4J2LoggerFactory(name);
        if (f != null) {
            return f;
        }

        f = useLog4JLoggerFactory(name);
        if (f != null) {
            return f;
        }

        return useJdkLoggerFactory(name);
    }

    private static InternalLoggerFactory useSlf4JLoggerFactory(String name) {
        try {
            InternalLoggerFactory f = Slf4JLoggerFactory.getInstanceWithNopCheck();
            f.newInstance(name).debug("Using SLF4J as the default logging framework");
            return f;
        } catch (LinkageError ignore) {
            return null;
        } catch (Exception ignore) {
            // We catch Exception and not ReflectiveOperationException as we still support java 6
            return null;
        }
    }

    private static InternalLoggerFactory useLog4J2LoggerFactory(String name) {
        try {
            InternalLoggerFactory f = Log4J2LoggerFactory.INSTANCE;
            f.newInstance(name).debug("Using Log4J2 as the default logging framework");
            return f;
        } catch (LinkageError ignore) {
            return null;
        } catch (Exception ignore) {
            // We catch Exception and not ReflectiveOperationException as we still support java 6
            return null;
        }
    }

    private static InternalLoggerFactory useLog4JLoggerFactory(String name) {
        try {
            InternalLoggerFactory f = Log4JLoggerFactory.INSTANCE;
            f.newInstance(name).debug("Using Log4J as the default logging framework");
            return f;
        } catch (LinkageError ignore) {
            return null;
        } catch (Exception ignore) {
            // We catch Exception and not ReflectiveOperationException as we still support java 6
            return null;
        }
    }

    private static InternalLoggerFactory useJdkLoggerFactory(String name) {
        InternalLoggerFactory f = JdkLoggerFactory.INSTANCE;
        f.newInstance(name).debug("Using java.util.logging as the default logging framework");
        return f;
    }

    /**
     * Returns the default factory.  The initial default factory is
     * {@link JdkLoggerFactory}.
     */
    public static InternalLoggerFactory getDefaultFactory() {
        if (defaultFactory == null) {
            defaultFactory = newDefaultFactory(InternalLoggerFactory.class.getName());
        }
        return defaultFactory;
    }

    /**

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free