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
Modifier and TypeClassDescriptionprotected static class
Maintains a mapping between native levels andLogLevel
. -
Field Summary
Fields inherited from class org.springframework.boot.logging.LoggingSystem
NONE, ROOT_LOGGER_NAME, SYSTEM_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
applySystemProperties
(Environment environment, LogFile logFile) void
Reset the logging system to be limit output.protected final ClassLoader
protected final String
getPackagedConfigFile
(String fileName) protected String
Return any self initialization config that has been applied.protected String[]
Return the spring config locations for this system.protected String
Return any spring specific initialization config that should be applied.protected abstract String[]
Return the standard config locations for this system.void
initialize
(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Fully initialize the logging system.protected abstract void
loadConfiguration
(LoggingInitializationContext initializationContext, String location, LogFile logFile) Load a specific configuration.protected abstract void
loadDefaults
(LoggingInitializationContext initializationContext, LogFile logFile) Load sensible defaults for the logging system.protected void
reinitialize
(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:LoggingSystem
Reset 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:
beforeInitialize
in classLoggingSystem
-
initialize
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Description copied from class:LoggingSystem
Fully initialize the logging system.- Overrides:
initialize
in classLoggingSystem
- Parameters:
initializationContext
- the logging initialization contextconfigLocation
- a log configuration location ornull
if default initialization is requiredlogFile
- the log output file that should be written ornull
for 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 ornull
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 contextlocation
- the location of the configuration to load (nevernull
)logFile
- the file to load ornull
if 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
-