Package org.springframework.boot.logging
Class LoggingSystem
java.lang.Object
org.springframework.boot.logging.LoggingSystem
- Direct Known Subclasses:
- AbstractLoggingSystem
Common abstraction over logging systems.
- Since:
- 1.0.0
- Author:
- Phillip Webb, Dave Syer, Andy Wilkinson, Ben Hale
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe name of anEnvironmentproperty used to indicate that a correlation ID is expected to be logged at some point.static final StringThe value of theSYSTEM_PROPERTYthat can be used to indicate that noLoggingSystemshould be used.static final StringThe name used for the root logger.static final StringA System property that can be used to indicate theLoggingSystemto use.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract voidReset the logging system to be limit output.voidcleanUp()Clean up the logging system.static LoggingSystemget(ClassLoader classLoader) Detect and return the logging system in use.getLoggerConfiguration(String loggerName) Returns the current configuration for aLoggingSystem's logger.Returns a collection of the current configuration for all aLoggingSystem's loggers.Returns aRunnablethat can handle shutdown of this logging system when the JVM exits.Returns a set of theLogLevelsthat are actually supported by the logging system.getSystemProperties(ConfigurableEnvironment environment) Return theLoggingSystemPropertiesthat should be applied.voidinitialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Fully initialize the logging system.voidsetLogLevel(String loggerName, LogLevel level) Sets the logging level for a given logger.
- 
Field Details- 
SYSTEM_PROPERTYA System property that can be used to indicate theLoggingSystemto use.
- 
NONEThe value of theSYSTEM_PROPERTYthat can be used to indicate that noLoggingSystemshould be used.- See Also:
 
- 
ROOT_LOGGER_NAMEThe name used for the root logger. LoggingSystem implementations should ensure that this is the name used to represent the root logger, regardless of the underlying implementation.- See Also:
 
- 
EXPECT_CORRELATION_ID_PROPERTYThe name of anEnvironmentproperty used to indicate that a correlation ID is expected to be logged at some point.- Since:
- 3.2.0
- See Also:
 
 
- 
- 
Constructor Details- 
LoggingSystempublic LoggingSystem()
 
- 
- 
Method Details- 
getSystemPropertiesReturn theLoggingSystemPropertiesthat should be applied.- Parameters:
- environment- the- ConfigurableEnvironmentused to obtain value
- Returns:
- the LoggingSystemPropertiesto apply
- Since:
- 2.4.0
 
- 
beforeInitializepublic abstract void beforeInitialize()Reset the logging system to be limit output. This method may be called beforeinitialize(LoggingInitializationContext, String, LogFile)to reduce logging noise until the system has been fully initialized.
- 
initializepublic void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Fully initialize the logging system.- Parameters:
- initializationContext- the logging initialization context
- configLocation- a log configuration location or- nullif default initialization is required
- logFile- the log output file that should be written or- nullfor console only output
 
- 
cleanUppublic void cleanUp()Clean up the logging system. The default implementation does nothing. Subclasses should override this method to perform any logging system-specific cleanup.
- 
getShutdownHandlerReturns aRunnablethat can handle shutdown of this logging system when the JVM exits. The default implementation returnsnull, indicating that no shutdown is required.- Returns:
- the shutdown handler, or null
 
- 
getSupportedLogLevelsReturns a set of theLogLevelsthat are actually supported by the logging system.- Returns:
- the supported levels
 
- 
setLogLevelSets the logging level for a given logger.- Parameters:
- loggerName- the name of the logger to set (- nullcan be used for the root logger).
- level- the log level (- nullcan be used to remove any custom level for the logger and use the default configuration instead)
 
- 
getLoggerConfigurationsReturns a collection of the current configuration for all aLoggingSystem's loggers.- Returns:
- the current configurations
- Since:
- 1.5.0
 
- 
getLoggerConfigurationReturns the current configuration for aLoggingSystem's logger.- Parameters:
- loggerName- the name of the logger
- Returns:
- the current configuration
- Since:
- 1.5.0
 
- 
getDetect and return the logging system in use. Supports Logback and Java Logging.- Parameters:
- classLoader- the classloader
- Returns:
- the logging system
 
 
-