Class Log4j2SpringBootLoggingSystem

  • java.lang.Object
    • org.springframework.boot.logging.LoggingSystem
      • org.springframework.boot.logging.AbstractLoggingSystem
        • org.springframework.boot.logging.Slf4JLoggingSystem
          • org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
            • org.apache.logging.log4j.spring.boot.Log4j2SpringBootLoggingSystem


  • public class Log4j2SpringBootLoggingSystem
    extends org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
    Override Spring's implementation of the Log4j 2 Logging System to properly support Spring Cloud Config.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Log4j2SpringBootLoggingSystem.Factory  
      • Nested classes/interfaces inherited from class org.springframework.boot.logging.AbstractLoggingSystem

        org.springframework.boot.logging.AbstractLoggingSystem.LogLevels<T extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ENVIRONMENT_KEY  
      static java.lang.String LOG4J2_DISABLE_CLOUD_CONFIG_LOGGING_SYSTEM
      Property that disables the usage of this LoggingSystem.
      • Fields inherited from class org.springframework.boot.logging.AbstractLoggingSystem

        CONFIGURATION_COMPARATOR
      • Fields inherited from class org.springframework.boot.logging.LoggingSystem

        NONE, ROOT_LOGGER_NAME, SYSTEM_PROPERTY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cleanUp​()  
      protected java.lang.String[] getStandardConfigLocations​()  
      void initialize​(org.springframework.boot.logging.LoggingInitializationContext initializationContext, java.lang.String configLocation, org.springframework.boot.logging.LogFile logFile)
      Set the environment into the ExternalContext field so that it can be obtained by SpringLookup when it is constructed.
      protected void loadConfiguration​(java.lang.String location, org.springframework.boot.logging.LogFile logFile)
      This method is removed from Spring in 3.x and is scheduled to be removed in 2.8.x.
      protected void loadConfiguration​(java.lang.String location, org.springframework.boot.logging.LogFile logFile, java.util.List<java.lang.String> overrides)
      Added in Spring 2.6.0, the overrides parameter allows override files to be specified in the "logging.log4j2.config.override" property.
      protected void loadDefaults​(org.springframework.boot.logging.LoggingInitializationContext initializationContext, org.springframework.boot.logging.LogFile logFile)  
      • Methods inherited from class org.springframework.boot.logging.AbstractLoggingSystem

        applySystemProperties, getClassLoader, getPackagedConfigFile, getSelfInitializationConfig, getSpringConfigLocations, getSpringInitializationConfig
      • Methods inherited from class org.springframework.boot.logging.log4j2.Log4J2LoggingSystem

        beforeInitialize, getLoggerConfiguration, getLoggerConfigurations, getShutdownHandler, getSupportedLogLevels, isClassAvailable, loadConfiguration, reinitialize, setLogLevel
      • Methods inherited from class org.springframework.boot.logging.LoggingSystem

        get, getSystemProperties
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class org.springframework.boot.logging.Slf4JLoggingSystem

        isBridgeHandlerAvailable, isBridgeJulIntoSlf4j
    • Field Detail

      • LOG4J2_DISABLE_CLOUD_CONFIG_LOGGING_SYSTEM

        public static final java.lang.String LOG4J2_DISABLE_CLOUD_CONFIG_LOGGING_SYSTEM
        Property that disables the usage of this LoggingSystem.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Log4j2SpringBootLoggingSystem

        public Log4j2SpringBootLoggingSystem​(java.lang.ClassLoader loader)
    • Method Detail

      • initialize

        public void initialize​(org.springframework.boot.logging.LoggingInitializationContext initializationContext,
                               java.lang.String configLocation,
                               org.springframework.boot.logging.LogFile logFile)
        Set the environment into the ExternalContext field so that it can be obtained by SpringLookup when it is constructed. Spring will replace the ExternalContext field with a String once initialization is complete.
        Overrides:
        initialize in class org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
        Parameters:
        initializationContext - The initialization context.
        configLocation - The configuration location.
        logFile - the log file.
      • getStandardConfigLocations

        protected java.lang.String[] getStandardConfigLocations​()
        Overrides:
        getStandardConfigLocations in class org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
      • loadDefaults

        protected void loadDefaults​(org.springframework.boot.logging.LoggingInitializationContext initializationContext,
                                    org.springframework.boot.logging.LogFile logFile)
        Overrides:
        loadDefaults in class org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
      • loadConfiguration

        protected void loadConfiguration​(java.lang.String location,
                                         org.springframework.boot.logging.LogFile logFile)
        This method is removed from Spring in 3.x and is scheduled to be removed in 2.8.x. It must be left in to support older Spring releases.
        Overrides:
        loadConfiguration in class org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
        Parameters:
        location - the location
        logFile - log file configuration
      • loadConfiguration

        protected void loadConfiguration​(java.lang.String location,
                                         org.springframework.boot.logging.LogFile logFile,
                                         java.util.List<java.lang.String> overrides)
        Added in Spring 2.6.0, the overrides parameter allows override files to be specified in the "logging.log4j2.config.override" property. However, spring does not support passing credentials when accessing the location. We do.
        Overrides:
        loadConfiguration in class org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
        Parameters:
        location - The location of the primary configuration.
        logFile - log file configuration.
        overrides - Any override files.
      • cleanUp

        public void cleanUp​()
        Overrides:
        cleanUp in class org.springframework.boot.logging.log4j2.Log4J2LoggingSystem

Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.