类 Log4J2LoggingSystem
java.lang.Object
org.springframework.boot.logging.LoggingSystem
org.springframework.boot.logging.AbstractLoggingSystem
org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
LoggingSystem for Log4j 2.- 从以下版本开始:
- 1.2.0
- 作者:
- Daniel Fullarton, Andy Wilkinson, Alexander Heusingfeld, Ben Hale, Ralph Goers
-
嵌套类概要
嵌套类从类继承的嵌套类/接口 org.springframework.boot.logging.AbstractLoggingSystem
AbstractLoggingSystem.LogLevels<T> -
字段概要
从类继承的字段 org.springframework.boot.logging.AbstractLoggingSystem
CONFIGURATION_COMPARATOR从类继承的字段 org.springframework.boot.logging.LoggingSystem
EXPECT_CORRELATION_ID_PROPERTY, NONE, ROOT_LOGGER_NAME, SYSTEM_PROPERTY -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidReset the logging system to be limit output.voidcleanUp()Clean up the logging system.protected StringReturn the default log correlation pattern ornullif log correlation patterns are not supported.static EnvironmentgetEnvironment(org.apache.logging.log4j.core.LoggerContext loggerContext) Get the SpringEnvironmentattached to the givenLoggerContextornullif no environment is available.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.protected String[]Return the standard config locations for this system.Returns a set of theLogLevelsthat are actually supported by the logging system.voidinitialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) Fully initialize the logging system.protected booleanisClassAvailable(String className) protected voidloadConfiguration(String location, LogFile logFile, List<String> overrides) Load the configuration from the givenlocation, creating a composite using the configuration from the givenoverrides.protected voidloadConfiguration(LoggingInitializationContext initializationContext, String location, LogFile logFile) Load a specific configuration.protected voidloadDefaults(LoggingInitializationContext initializationContext, LogFile logFile) Load sensible defaults for the logging system.protected voidreinitialize(LoggingInitializationContext initializationContext) Reinitialize the logging system if required.voidsetLogLevel(String loggerName, LogLevel logLevel) Sets the logging level for a given logger.从类继承的方法 org.springframework.boot.logging.AbstractLoggingSystem
applySystemProperties, getClassLoader, getDefaultValueResolver, getPackagedConfigFile, getSelfInitializationConfig, getSpringConfigLocations, getSpringInitializationConfig从类继承的方法 org.springframework.boot.logging.LoggingSystem
get, getSystemProperties
-
构造器详细资料
-
Log4J2LoggingSystem
-
-
方法详细资料
-
getStandardConfigLocations
从类复制的说明:AbstractLoggingSystemReturn the standard config locations for this system.- 指定者:
getStandardConfigLocations在类中AbstractLoggingSystem- 返回:
- the standard config locations
- 另请参阅:
-
isClassAvailable
-
beforeInitialize
public void beforeInitialize()从类复制的说明:LoggingSystemReset 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. -
initialize
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) 从类复制的说明:LoggingSystemFully initialize the logging system.- 覆盖:
initialize在类中AbstractLoggingSystem- 参数:
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
-
loadDefaults
从类复制的说明:AbstractLoggingSystemLoad sensible defaults for the logging system.- 指定者:
loadDefaults在类中AbstractLoggingSystem- 参数:
initializationContext- the logging initialization contextlogFile- the file to load ornullif no log file is to be written
-
loadConfiguration
protected void loadConfiguration(LoggingInitializationContext initializationContext, String location, LogFile logFile) 从类复制的说明:AbstractLoggingSystemLoad a specific configuration.- 指定者:
loadConfiguration在类中AbstractLoggingSystem- 参数:
initializationContext- the logging initialization contextlocation- the location of the configuration to load (nevernull)logFile- the file to load ornullif no log file is to be written
-
loadConfiguration
Load the configuration from the givenlocation, creating a composite using the configuration from the givenoverrides.- 参数:
location- the locationlogFile- log file configurationoverrides- the overriding locations- 从以下版本开始:
- 2.6.0
-
reinitialize
从类复制的说明:AbstractLoggingSystemReinitialize 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).- 覆盖:
reinitialize在类中AbstractLoggingSystem- 参数:
initializationContext- the logging initialization context
-
getSupportedLogLevels
从类复制的说明:LoggingSystemReturns a set of theLogLevelsthat are actually supported by the logging system.- 覆盖:
getSupportedLogLevels在类中LoggingSystem- 返回:
- the supported levels
-
setLogLevel
从类复制的说明:LoggingSystemSets the logging level for a given logger.- 覆盖:
setLogLevel在类中LoggingSystem- 参数:
loggerName- the name of the logger to set (nullcan be used for the root logger).logLevel- the log level (nullcan be used to remove any custom level for the logger and use the default configuration instead)
-
getLoggerConfigurations
从类复制的说明:LoggingSystemReturns a collection of the current configuration for all aLoggingSystem's loggers.- 覆盖:
getLoggerConfigurations在类中LoggingSystem- 返回:
- the current configurations
-
getLoggerConfiguration
从类复制的说明:LoggingSystemReturns the current configuration for aLoggingSystem's logger.- 覆盖:
getLoggerConfiguration在类中LoggingSystem- 参数:
loggerName- the name of the logger- 返回:
- the current configuration
-
getShutdownHandler
从类复制的说明:LoggingSystemReturns aRunnablethat can handle shutdown of this logging system when the JVM exits. The default implementation returnsnull, indicating that no shutdown is required.- 覆盖:
getShutdownHandler在类中LoggingSystem- 返回:
- the shutdown handler, or
null
-
cleanUp
public void cleanUp()从类复制的说明:LoggingSystemClean up the logging system. The default implementation does nothing. Subclasses should override this method to perform any logging system-specific cleanup.- 覆盖:
cleanUp在类中LoggingSystem
-
getDefaultLogCorrelationPattern
从类复制的说明:AbstractLoggingSystemReturn the default log correlation pattern ornullif log correlation patterns are not supported.- 覆盖:
getDefaultLogCorrelationPattern在类中AbstractLoggingSystem- 返回:
- the default log correlation pattern
-
getEnvironment
Get the SpringEnvironmentattached to the givenLoggerContextornullif no environment is available.- 参数:
loggerContext- the logger context- 返回:
- the Spring
Environmentornull - 从以下版本开始:
- 3.0.0
-