Class JavaLoggingSystem
- java.lang.Object
- org.springframework.boot.logging.LoggingSystem
- org.springframework.boot.logging.AbstractLoggingSystem
- org.springframework.boot.logging.java.JavaLoggingSystem
public class JavaLoggingSystem extends AbstractLoggingSystem
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.boot.logging.AbstractLoggingSystem
AbstractLoggingSystem.LogLevels<T>
Field Summary
Fields inherited from class org.springframework.boot.logging.AbstractLoggingSystem
CONFIGURATION_COMPARATOR
Fields inherited from class org.springframework.boot.logging.LoggingSystem
NONE, ROOT_LOGGER_NAME, SYSTEM_PROPERTY
Constructor Summary
Constructors Constructor Description JavaLoggingSystem(ClassLoader classLoader)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeInitialize()
Reset the logging system to be limit output.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.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.void
setLogLevel(String loggerName, LogLevel level)
Sets the logging level for a given logger.Methods inherited from class org.springframework.boot.logging.AbstractLoggingSystem
applySystemProperties, getClassLoader, getPackagedConfigFile, getSelfInitializationConfig, getSpringConfigLocations, getSpringInitializationConfig, initialize, reinitialize
Methods inherited from class org.springframework.boot.logging.LoggingSystem
cleanUp, get
Constructor Detail
JavaLoggingSystem
public JavaLoggingSystem(ClassLoader classLoader)
Method Detail
getStandardConfigLocations
protected String[] getStandardConfigLocations()
Description copied from class:AbstractLoggingSystem
Return the standard config locations for this system.- Specified by:
getStandardConfigLocations
in classAbstractLoggingSystem
- Returns:
- the standard config locations
- See Also:
AbstractLoggingSystem.getSelfInitializationConfig()
beforeInitialize
public void beforeInitialize()
Description copied from class: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.- Overrides:
beforeInitialize
in classAbstractLoggingSystem
loadDefaults
protected void loadDefaults(LoggingInitializationContext initializationContext, LogFile logFile)
Description copied from class:AbstractLoggingSystem
Load sensible defaults for the logging system.- Specified by:
loadDefaults
in classAbstractLoggingSystem
- Parameters:
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)
Description copied from class:AbstractLoggingSystem
Load a specific configuration.- Specified by:
loadConfiguration
in classAbstractLoggingSystem
- Parameters:
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)
getSupportedLogLevels
public Set<LogLevel> getSupportedLogLevels()
Description copied from class:LoggingSystem
Returns a set of theLogLevels
that are actually supported by the logging system.- Overrides:
getSupportedLogLevels
in classLoggingSystem
- Returns:
- the supported levels
setLogLevel
public void setLogLevel(String loggerName, LogLevel level)
Description copied from class:LoggingSystem
Sets the logging level for a given logger.- Overrides:
setLogLevel
in classLoggingSystem
- Parameters:
loggerName
- the name of the logger to set (null
can be used for the root logger).level
- 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()
Description copied from class:LoggingSystem
Returns a collection of the current configuration for all aLoggingSystem
's loggers.- Overrides:
getLoggerConfigurations
in classLoggingSystem
- Returns:
- the current configurations
getLoggerConfiguration
public LoggerConfiguration getLoggerConfiguration(String loggerName)
Description copied from class:LoggingSystem
Returns the current configuration for aLoggingSystem
's logger.- Overrides:
getLoggerConfiguration
in classLoggingSystem
- Parameters:
loggerName
- the name of the logger- Returns:
- the current configuration
getShutdownHandler
public Runnable getShutdownHandler()
Description copied from class: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.- Overrides:
getShutdownHandler
in classLoggingSystem
- Returns:
- the shutdown handler, or
null