Class AbstractLoggingSystem

java.lang.Object
org.springframework.boot.logging.LoggingSystem
org.springframework.boot.logging.AbstractLoggingSystem
Direct Known Subclasses:
JavaLoggingSystem, Log4J2LoggingSystem, LogbackLoggingSystem

public abstract class AbstractLoggingSystem extends LoggingSystem
Abstract base class for LoggingSystem implementations.
Since:
1.0.0
  • Field Details

  • Constructor Details

    • AbstractLoggingSystem

      public AbstractLoggingSystem(ClassLoader classLoader)
  • Method Details

    • beforeInitialize

      public void beforeInitialize()
      Description copied from class: LoggingSystem
      Reset the logging system to be limit output. This method may be called before LoggingSystem.initialize(LoggingInitializationContext, String, LogFile) to reduce logging noise until the system has been fully initialized.
      Specified by:
      beforeInitialize in class LoggingSystem
    • initialize

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

      protected String getSelfInitializationConfig()
      Return any self initialization config that has been applied. By default this method checks getStandardConfigLocations() and assumes that any file that exists will have been applied.
      Returns:
      the self initialization config or null
    • getSpringInitializationConfig

      protected String getSpringInitializationConfig()
      Return any spring specific initialization config that should be applied. By default this method checks getSpringConfigLocations().
      Returns:
      the spring initialization config or null
    • getStandardConfigLocations

      protected abstract String[] getStandardConfigLocations()
      Return the standard config locations for this system.
      Returns:
      the standard config locations
      See Also:
    • getSpringConfigLocations

      protected String[] getSpringConfigLocations()
      Return the spring config locations for this system. By default this method returns a set of locations based on getStandardConfigLocations().
      Returns:
      the spring config locations
      See Also:
    • loadDefaults

      protected abstract void loadDefaults(LoggingInitializationContext initializationContext, LogFile logFile)
      Load sensible defaults for the logging system.
      Parameters:
      initializationContext - the logging initialization context
      logFile - the file to load or null if no log file is to be written
    • loadConfiguration

      protected abstract void loadConfiguration(LoggingInitializationContext initializationContext, String location, LogFile logFile)
      Load a specific configuration.
      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
    • reinitialize

      protected void reinitialize(LoggingInitializationContext initializationContext)
      Reinitialize the logging system if required. Called when getSelfInitializationConfig() is used and the log file hasn't changed. May be used to reload configuration (for example to pick up additional System properties).
      Parameters:
      initializationContext - the logging initialization context
    • getClassLoader

      protected final ClassLoader getClassLoader()
    • getPackagedConfigFile

      protected final String getPackagedConfigFile(String fileName)
    • applySystemProperties

      protected final void applySystemProperties(org.springframework.core.env.Environment environment, LogFile logFile)