Class LogbackLoggingSystem
java.lang.Object
org.springframework.boot.logging.LoggingSystem
org.springframework.boot.logging.AbstractLoggingSystem
org.springframework.boot.logging.logback.LogbackLoggingSystem
LoggingSystem
for logback.- Since:
- 1.0.0
- Author:
- Phillip Webb, Dave Syer, Andy Wilkinson, Ben Hale
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
LoggingSystemFactory
that returnsLogbackLoggingSystem
if possible.Nested classes/interfaces inherited from class org.springframework.boot.logging.AbstractLoggingSystem
AbstractLoggingSystem.LogLevels<T>
-
Field Summary
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Reset the logging system to be limit output.void
cleanUp()
Clean up the logging system.getLoggerConfiguration
(String loggerName) Returns the current configuration for aLoggingSystem
's logger.Returns a collection of the current configuration for all aLoggingSystem
's loggers.Returns aRunnable
that can handle shutdown of this logging system when the JVM exits.protected String[]
Return the standard config locations for this system.Returns a set of theLogLevels
that are actually supported by the logging system.getSystemProperties
(ConfigurableEnvironment environment) Return theLoggingSystemProperties
that should be applied.void
initialize
(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Fully initialize the logging system.protected void
loadConfiguration
(LoggingInitializationContext initializationContext, String location, LogFile logFile) Load a specific configuration.protected void
loadDefaults
(LoggingInitializationContext initializationContext, LogFile logFile) Load sensible defaults for the logging system.protected void
reinitialize
(LoggingInitializationContext initializationContext) Reinitialize the logging system if required.void
setLogLevel
(String loggerName, LogLevel level) Sets the logging level for a given logger.Methods inherited from class org.springframework.boot.logging.AbstractLoggingSystem
applySystemProperties, getClassLoader, getPackagedConfigFile, getSelfInitializationConfig, getSpringConfigLocations, getSpringInitializationConfig
Methods inherited from class org.springframework.boot.logging.LoggingSystem
get
-
Constructor Details
-
LogbackLoggingSystem
-
-
Method Details
-
getSystemProperties
Description copied from class:LoggingSystem
Return theLoggingSystemProperties
that should be applied.- Overrides:
getSystemProperties
in classLoggingSystem
- Parameters:
environment
- theConfigurableEnvironment
used to obtain value- Returns:
- the
LoggingSystemProperties
to apply
-
getStandardConfigLocations
Description copied from class:AbstractLoggingSystem
Return the standard config locations for this system.- Specified by:
getStandardConfigLocations
in classAbstractLoggingSystem
- Returns:
- the standard config locations
- See Also:
-
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.- Overrides:
beforeInitialize
in classAbstractLoggingSystem
-
initialize
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Description copied from class:LoggingSystem
Fully initialize the logging system.- Overrides:
initialize
in classAbstractLoggingSystem
- 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
-
loadDefaults
Description copied from class:AbstractLoggingSystem
Load sensible defaults for the logging system.- Specified by:
loadDefaults
in classAbstractLoggingSystem
- Parameters:
initializationContext
- the logging initialization contextlogFile
- the file to load ornull
if no log file is to be written
-
loadConfiguration
protected void loadConfiguration(LoggingInitializationContext initializationContext, String location, LogFile logFile) Description copied from class:AbstractLoggingSystem
Load a specific configuration.- Specified by:
loadConfiguration
in classAbstractLoggingSystem
- 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
-
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 classLoggingSystem
-
reinitialize
Description copied from class:AbstractLoggingSystem
Reinitialize the logging system if required. Called whenAbstractLoggingSystem.getSelfInitializationConfig()
is used and the log file hasn't changed. May be used to reload configuration (for example to pick up additional System properties).- Overrides:
reinitialize
in classAbstractLoggingSystem
- Parameters:
initializationContext
- the logging initialization context
-
getLoggerConfigurations
Description copied from class:LoggingSystem
Returns a collection of the current configuration for all aLoggingSystem
's loggers.- Overrides:
getLoggerConfigurations
in classLoggingSystem
- Returns:
- the current configurations
-
getLoggerConfiguration
Description copied from class:LoggingSystem
Returns the current configuration for aLoggingSystem
's logger.- Overrides:
getLoggerConfiguration
in classLoggingSystem
- Parameters:
loggerName
- the name of the logger- Returns:
- the current configuration
-
getSupportedLogLevels
Description copied from class:LoggingSystem
Returns a set of theLogLevels
that are actually supported by the logging system.- Overrides:
getSupportedLogLevels
in classLoggingSystem
- Returns:
- the supported levels
-
setLogLevel
Description copied from class:LoggingSystem
Sets the logging level for a given logger.- Overrides:
setLogLevel
in classLoggingSystem
- Parameters:
loggerName
- the name of the logger to set (null
can be used for the root logger).level
- the log level (null
can be used to remove any custom level for the logger and use the default configuration instead)
-
getShutdownHandler
Description copied from class:LoggingSystem
Returns aRunnable
that can handle shutdown of this logging system when the JVM exits. The default implementation returnsnull
, indicating that no shutdown is required.- Overrides:
getShutdownHandler
in classLoggingSystem
- Returns:
- the shutdown handler, or
null
-