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.@Nullable LoggerConfigurationgetLoggerConfiguration(String loggerName) Returns the current configuration for aLoggingSystem's logger.Returns a collection of the current configuration for all aLoggingSystem's loggers.@Nullable RunnableReturns 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, @Nullable String configLocation, @Nullable LogFile logFile) Fully initialize the logging system.voidsetLogLevel(@Nullable String loggerName, @Nullable 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, @Nullable String configLocation, @Nullable 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.
- 
getShutdownHandler
- 
getSupportedLogLevels
- 
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
 
 
-