Package org.springframework.boot.logging
Class AbstractLoggingSystem
java.lang.Object
org.springframework.boot.logging.LoggingSystem
org.springframework.boot.logging.AbstractLoggingSystem
- Direct Known Subclasses:
JavaLoggingSystem,Log4J2LoggingSystem,LogbackLoggingSystem
Abstract base class for
LoggingSystem implementations.- Since:
- 1.0.0
- Author:
- Phillip Webb, Dave Syer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classMaintains a mapping between native levels andLogLevel. -
Field Summary
FieldsFields inherited from class org.springframework.boot.logging.LoggingSystem
EXPECT_CORRELATION_ID_PROPERTY, NONE, ROOT_LOGGER_NAME, SYSTEM_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidapplySystemProperties(Environment environment, LogFile logFile) voidReset the logging system to be limit output.protected final ClassLoaderprotected StringReturn the default log correlation pattern ornullif log correlation patterns are not supported.getDefaultValueResolver(Environment environment) Return the default value resolver to use when resolving system properties.protected final StringgetPackagedConfigFile(String fileName) protected StringReturn any self initialization config that has been applied.protected String[]Return the spring config locations for this system.protected StringReturn any spring specific initialization config that should be applied.protected abstract String[]Return the standard config locations for this system.voidinitialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Fully initialize the logging system.protected abstract voidloadConfiguration(LoggingInitializationContext initializationContext, String location, LogFile logFile) Load a specific configuration.protected abstract voidloadDefaults(LoggingInitializationContext initializationContext, LogFile logFile) Load sensible defaults for the logging system.protected voidreinitialize(LoggingInitializationContext initializationContext) Reinitialize the logging system if required.Methods inherited from class org.springframework.boot.logging.LoggingSystem
cleanUp, get, getLoggerConfiguration, getLoggerConfigurations, getShutdownHandler, getSupportedLogLevels, getSystemProperties, setLogLevel
-
Field Details
-
CONFIGURATION_COMPARATOR
-
-
Constructor Details
-
AbstractLoggingSystem
-
-
Method Details
-
beforeInitialize
public void beforeInitialize()Description copied from class:LoggingSystemReset the logging system to be limit output. This method may be called beforeLoggingSystem.initialize(LoggingInitializationContext, String, LogFile)to reduce logging noise until the system has been fully initialized.- Specified by:
beforeInitializein classLoggingSystem
-
initialize
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Description copied from class:LoggingSystemFully initialize the logging system.- Overrides:
initializein classLoggingSystem- Parameters:
initializationContext- the logging initialization contextconfigLocation- a log configuration location ornullif default initialization is requiredlogFile- the log output file that should be written ornullfor console only output
-
getSelfInitializationConfig
Return any self initialization config that has been applied. By default this method checksgetStandardConfigLocations()and assumes that any file that exists will have been applied.- Returns:
- the self initialization config or
null
-
getSpringInitializationConfig
Return any spring specific initialization config that should be applied. By default this method checksgetSpringConfigLocations().- Returns:
- the spring initialization config or
null
-
getStandardConfigLocations
Return the standard config locations for this system.- Returns:
- the standard config locations
- See Also:
-
getSpringConfigLocations
Return the spring config locations for this system. By default this method returns a set of locations based ongetStandardConfigLocations().- 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 contextlogFile- the file to load ornullif 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 contextlocation- the location of the configuration to load (nevernull)logFile- the file to load ornullif no log file is to be written
-
reinitialize
Reinitialize the logging system if required. Called whengetSelfInitializationConfig()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
-
getPackagedConfigFile
-
applySystemProperties
-
getDefaultValueResolver
Return the default value resolver to use when resolving system properties.- Parameters:
environment- the environment- Returns:
- the default value resolver
- Since:
- 3.2.0
-
getDefaultLogCorrelationPattern
Return the default log correlation pattern ornullif log correlation patterns are not supported.- Returns:
- the default log correlation pattern
- Since:
- 3.2.0
-