org.springframework.boot.logging

Class LoggingSystem

  • Direct Known Subclasses:
    AbstractLoggingSystem


    public abstract class LoggingSystem
    extends Object
    Common abstraction over logging systems.
    Author:
    Phillip Webb, Dave Syer, Andy Wilkinson
    • Field Detail

      • SYSTEM_PROPERTY

        public static final String SYSTEM_PROPERTY
        A System property that can be used to indicate the LoggingSystem to use.
    • Constructor Detail

      • LoggingSystem

        public LoggingSystem()
    • Method Detail

      • initialize

        public void initialize(LoggingInitializationContext initializationContext,
                               String configLocation,
                               LogFile logFile)
        Fully initialize the logging system.
        Parameters:
        initializationContext - the logging initialization context
        configLocation - a log configuration location or null if default initialization is required
        logFile - the log output file that should be written or null for console only output
      • initialize

        @Deprecated
        public void initialize(String configLocation,
                                           LogFile logFile)
        Fully initialize the logging system.
        Parameters:
        configLocation - a log configuration location or null if default initialization is required
        logFile - the log output file that should be written or null for console only output
      • cleanUp

        public void cleanUp()
        Clean up the logging system. The default implementation does nothing. Subclasses should override this method to perform any logging system-specific cleanup.
      • getShutdownHandler

        public Runnable getShutdownHandler()
        Returns a Runnable that can handle shutdown of this logging system when the JVM exits. The default implementation returns null, indicating that no shutdown is required.
        Returns:
        the shutdown handler, or null
      • setLogLevel

        public abstract void setLogLevel(String loggerName,
                                         LogLevel level)
        Sets the logging level for a given logger.
        Parameters:
        loggerName - the name of the logger to set
        level - the log level
      • get

        public static LoggingSystem get(ClassLoader classLoader)
        Detect and return the logging system in use. Supports Logback, Log4J, Log4J2 and Java Logging.
        Parameters:
        classLoader - the classloader
        Returns:
        The logging system

Copyright © 2016 Pivotal Software, Inc.. All rights reserved.