org.springframework.boot.logging.log4j2

Class Log4J2LoggingSystem

    • Constructor Detail

      • Log4J2LoggingSystem

        public Log4J2LoggingSystem(java.lang.ClassLoader classLoader)
    • Method Detail

      • isClassAvailable

        protected boolean isClassAvailable(java.lang.String className)
      • initialize

        public void initialize(LoggingInitializationContext initializationContext,
                               java.lang.String configLocation,
                               LogFile logFile)
        Description copied from class: LoggingSystem
        Fully initialize the logging system.
        Overrides:
        initialize in class AbstractLoggingSystem
        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
      • loadConfiguration

        protected void loadConfiguration(LoggingInitializationContext initializationContext,
                                         java.lang.String location,
                                         LogFile logFile)
        Description copied from class: AbstractLoggingSystem
        Load a specific configuration.
        Overrides:
        loadConfiguration in class Slf4JLoggingSystem
        Parameters:
        initializationContext - the logging initialization context
        location - the location of the configuration to load (never null)
        logFile - the file to load or null if no log file is to be written
      • loadConfiguration

        @Deprecated
        protected void loadConfiguration(java.lang.String location,
                                                     LogFile logFile)
        Deprecated. since 2.6.0 for removal in 2.8.0 in favor of loadConfiguration(String, LogFile, List)
        Load the configuration from the given location.
        Parameters:
        location - the location
        logFile - log file configuration
      • loadConfiguration

        protected void loadConfiguration(java.lang.String location,
                                         LogFile logFile,
                                         java.util.List<java.lang.String> overrides)
        Load the configuration from the given location, creating a composite using the configuration from the given overrides.
        Parameters:
        location - the location
        logFile - log file configuration
        overrides - the overriding locations
        Since:
        2.6.0
      • setLogLevel

        public void setLogLevel(java.lang.String loggerName,
                                LogLevel logLevel)
        Description copied from class: LoggingSystem
        Sets the logging level for a given logger.
        Overrides:
        setLogLevel in class LoggingSystem
        Parameters:
        loggerName - the name of the logger to set (null can be used for the root logger).
        logLevel - the log level (null can be used to remove any custom level for the logger and use the default configuration instead)
      • getShutdownHandler

        public java.lang.Runnable getShutdownHandler()
        Description copied from class: LoggingSystem
        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.
        Overrides:
        getShutdownHandler in class LoggingSystem
        Returns:
        the shutdown handler, or null
      • cleanUp

        public void cleanUp()
        Description copied from class: LoggingSystem
        Clean up the logging system. The default implementation does nothing. Subclasses should override this method to perform any logging system-specific cleanup.
        Overrides:
        cleanUp in class Slf4JLoggingSystem