Class InternalLoggerFactory

java.lang.Object
io.micrometer.core.util.internal.logging.InternalLoggerFactory
Direct Known Subclasses:
JdkLoggerFactory, Slf4JLoggerFactory

public abstract class InternalLoggerFactory
extends java.lang.Object
NOTE: This file has been copied and simplified from {io.netty.util.internal.logging}. Creates an InternalLogger or changes the default factory implementation. This factory allows you to choose what logging framework Micrometer should use. The default factory is Slf4JLoggerFactory. If SLF4J is not available, JdkLoggerFactory is used. You can change it to your preferred logging framework before other Micrometer classes are loaded:
 InternalLoggerFactory.setDefaultFactory(JdkLoggerFactory.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.
  • Constructor Summary

    Constructors 
    Constructor Description
    InternalLoggerFactory()  
  • Method Summary

    Modifier and Type Method Description
    static InternalLoggerFactory getDefaultFactory()
    Returns the default factory.
    static InternalLogger getInstance​(java.lang.Class<?> clazz)
    Creates a new logger instance with the name of the specified class.
    static InternalLogger getInstance​(java.lang.String name)
    Creates a new logger instance with the specified name.
    protected abstract InternalLogger newInstance​(java.lang.String name)
    Creates a new logger instance with the specified name.
    static void setDefaultFactory​(InternalLoggerFactory defaultFactory)
    Changes the default factory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getDefaultFactory

      public static InternalLoggerFactory getDefaultFactory()
      Returns the default factory.
      Returns:
      default factory
    • setDefaultFactory

      public static void setDefaultFactory​(InternalLoggerFactory defaultFactory)
      Changes the default factory.
      Parameters:
      defaultFactory - default factory
    • getInstance

      public static InternalLogger getInstance​(java.lang.Class<?> clazz)
      Creates a new logger instance with the name of the specified class.
      Parameters:
      clazz - class to use for a logger name
      Returns:
      logger instance
    • getInstance

      public static InternalLogger getInstance​(java.lang.String name)
      Creates a new logger instance with the specified name.
      Parameters:
      name - logger name
      Returns:
      logger instance
    • newInstance

      protected abstract InternalLogger newInstance​(java.lang.String name)
      Creates a new logger instance with the specified name.
      Parameters:
      name - logger name
      Returns:
      logger instance