类 Log4J2LoggingSystem
- java.lang.Object
- org.springframework.boot.logging.LoggingSystem
- org.springframework.boot.logging.AbstractLoggingSystem
- org.springframework.boot.logging.Slf4JLoggingSystem
- org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
public class Log4J2LoggingSystem extends Slf4JLoggingSystem
LoggingSystem
for Log4j 2.- 从以下版本开始:
- 1.2.0
嵌套类概要
从类继承的嵌套类/接口 org.springframework.boot.logging.AbstractLoggingSystem
AbstractLoggingSystem.LogLevels<T>
字段概要
从类继承的字段 org.springframework.boot.logging.AbstractLoggingSystem
CONFIGURATION_COMPARATOR
从类继承的字段 org.springframework.boot.logging.LoggingSystem
NONE, ROOT_LOGGER_NAME, SYSTEM_PROPERTY
构造器概要
构造器 构造器 说明 Log4J2LoggingSystem(ClassLoader classLoader)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
beforeInitialize()
Reset the logging system to be limit output.void
cleanUp()
Clean up the logging system.LoggerConfiguration
getLoggerConfiguration(String loggerName)
Returns the current configuration for aLoggingSystem
's logger.List<LoggerConfiguration>
getLoggerConfigurations()
Returns a collection of the current configuration for all aLoggingSystem
's loggers.Runnable
getShutdownHandler()
Returns aRunnable
that can handle shutdown of this logging system when the JVM exits.protected String[]
getStandardConfigLocations()
Return the standard config locations for this system.Set<LogLevel>
getSupportedLogLevels()
Returns a set of theLogLevels
that are actually supported by the logging system.void
initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile)
Fully initialize the logging system.protected boolean
isClassAvailable(String className)
protected void
loadConfiguration(String location, LogFile logFile)
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 logLevel)
Sets the logging level for a given logger.从类继承的方法 org.springframework.boot.logging.Slf4JLoggingSystem
isBridgeHandlerAvailable, isBridgeJulIntoSlf4j
从类继承的方法 org.springframework.boot.logging.AbstractLoggingSystem
applySystemProperties, getClassLoader, getPackagedConfigFile, getSelfInitializationConfig, getSpringConfigLocations, getSpringInitializationConfig
从类继承的方法 org.springframework.boot.logging.LoggingSystem
get
构造器详细资料
Log4J2LoggingSystem
public Log4J2LoggingSystem(ClassLoader classLoader)
方法详细资料
getStandardConfigLocations
protected String[] getStandardConfigLocations()
从类复制的说明:AbstractLoggingSystem
Return the standard config locations for this system.- 指定者:
getStandardConfigLocations
在类中AbstractLoggingSystem
- 返回:
- the standard config locations
- 另请参阅:
AbstractLoggingSystem.getSelfInitializationConfig()
isClassAvailable
protected boolean isClassAvailable(String className)
beforeInitialize
public void beforeInitialize()
从类复制的说明: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.
initialize
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile)
从类复制的说明:LoggingSystem
Fully initialize the logging system.- 覆盖:
initialize
在类中AbstractLoggingSystem
- 参数:
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
protected void loadDefaults(LoggingInitializationContext initializationContext, LogFile logFile)
从类复制的说明:AbstractLoggingSystem
Load sensible defaults for the logging system.- 指定者:
loadDefaults
在类中AbstractLoggingSystem
- 参数:
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)
从类复制的说明:AbstractLoggingSystem
Load a specific configuration.- 覆盖:
loadConfiguration
在类中Slf4JLoggingSystem
- 参数:
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
loadConfiguration
protected void loadConfiguration(String location, LogFile logFile)
reinitialize
protected void reinitialize(LoggingInitializationContext initializationContext)
从类复制的说明: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).- 覆盖:
reinitialize
在类中AbstractLoggingSystem
- 参数:
initializationContext
- the logging initialization context
getSupportedLogLevels
public Set<LogLevel> getSupportedLogLevels()
从类复制的说明:LoggingSystem
Returns a set of theLogLevels
that are actually supported by the logging system.- 覆盖:
getSupportedLogLevels
在类中LoggingSystem
- 返回:
- the supported levels
setLogLevel
public void setLogLevel(String loggerName, LogLevel logLevel)
从类复制的说明:LoggingSystem
Sets the logging level for a given logger.- 覆盖:
setLogLevel
在类中LoggingSystem
- 参数:
loggerName
- the name of the logger to set (null
can be used for the root logger).logLevel
- the log level (null
can be used to remove any custom level for the logger and use the default configuration instead)
getLoggerConfigurations
public List<LoggerConfiguration> getLoggerConfigurations()
从类复制的说明:LoggingSystem
Returns a collection of the current configuration for all aLoggingSystem
's loggers.- 覆盖:
getLoggerConfigurations
在类中LoggingSystem
- 返回:
- the current configurations
getLoggerConfiguration
public LoggerConfiguration getLoggerConfiguration(String loggerName)
从类复制的说明:LoggingSystem
Returns the current configuration for aLoggingSystem
's logger.- 覆盖:
getLoggerConfiguration
在类中LoggingSystem
- 参数:
loggerName
- the name of the logger- 返回:
- the current configuration
getShutdownHandler
public Runnable getShutdownHandler()
从类复制的说明: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.- 覆盖:
getShutdownHandler
在类中LoggingSystem
- 返回:
- the shutdown handler, or
null
cleanUp
public void cleanUp()
从类复制的说明:LoggingSystem
Clean up the logging system. The default implementation does nothing. Subclasses should override this method to perform any logging system-specific cleanup.- 覆盖:
cleanUp
在类中Slf4JLoggingSystem