类 LoggingSystem
java.lang.Object
org.springframework.boot.logging.LoggingSystem
- 直接已知子类:
AbstractLoggingSystem
Common abstraction over logging systems.
- 从以下版本开始:
- 1.0.0
- 作者:
- Phillip Webb, Dave Syer, Andy Wilkinson, Ben Hale
-
字段概要
字段修饰符和类型字段说明static 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. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明abstract 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.
-
字段详细资料
-
SYSTEM_PROPERTY
A System property that can be used to indicate theLoggingSystemto use. -
NONE
The value of theSYSTEM_PROPERTYthat can be used to indicate that noLoggingSystemshould be used.- 另请参阅:
-
ROOT_LOGGER_NAME
The 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.- 另请参阅:
-
EXPECT_CORRELATION_ID_PROPERTY
The name of anEnvironmentproperty used to indicate that a correlation ID is expected to be logged at some point.- 从以下版本开始:
- 3.2.0
- 另请参阅:
-
-
构造器详细资料
-
LoggingSystem
public LoggingSystem()
-
-
方法详细资料
-
getSystemProperties
Return theLoggingSystemPropertiesthat should be applied.- 参数:
environment- theConfigurableEnvironmentused to obtain value- 返回:
- the
LoggingSystemPropertiesto apply - 从以下版本开始:
- 2.4.0
-
beforeInitialize
public 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. -
initialize
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Fully initialize the logging system.- 参数:
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
-
cleanUp
public 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
Returns aRunnablethat can handle shutdown of this logging system when the JVM exits. The default implementation returnsnull, indicating that no shutdown is required.- 返回:
- the shutdown handler, or
null
-
getSupportedLogLevels
Returns a set of theLogLevelsthat are actually supported by the logging system.- 返回:
- the supported levels
-
setLogLevel
Sets the logging level for a given logger.- 参数:
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)
-
getLoggerConfigurations
Returns a collection of the current configuration for all aLoggingSystem's loggers.- 返回:
- the current configurations
- 从以下版本开始:
- 1.5.0
-
getLoggerConfiguration
Returns the current configuration for aLoggingSystem's logger.- 参数:
loggerName- the name of the logger- 返回:
- the current configuration
- 从以下版本开始:
- 1.5.0
-
get
Detect and return the logging system in use. Supports Logback and Java Logging.- 参数:
classLoader- the classloader- 返回:
- the logging system
-