public class Log4J2LoggingSystem extends Slf4JLoggingSystem
LoggingSystem for Log4j 2.AbstractLoggingSystem.LogLevels<T>CONFIGURATION_COMPARATORNONE, ROOT_LOGGER_NAME, SYSTEM_PROPERTY| Constructor and Description |
|---|
Log4J2LoggingSystem(ClassLoader classLoader) |
| Modifier and Type | Method and Description |
|---|---|
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 a
LoggingSystem's logger. |
List<LoggerConfiguration> |
getLoggerConfigurations()
Returns a collection of the current configuration for all a
LoggingSystem's
loggers. |
Runnable |
getShutdownHandler()
Returns a
Runnable 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 the
LogLevels 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(LoggingInitializationContext initializationContext,
String location,
LogFile logFile)
Load a specific configuration.
|
protected void |
loadConfiguration(String location,
LogFile logFile) |
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.
|
isBridgeHandlerAvailable, isBridgeJulIntoSlf4japplySystemProperties, getClassLoader, getPackagedConfigFile, getSelfInitializationConfig, getSpringConfigLocations, getSpringInitializationConfiggetpublic Log4J2LoggingSystem(ClassLoader classLoader)
protected String[] getStandardConfigLocations()
AbstractLoggingSystemgetStandardConfigLocations in class AbstractLoggingSystemAbstractLoggingSystem.getSelfInitializationConfig()protected boolean isClassAvailable(String className)
public void beforeInitialize()
LoggingSystemLoggingSystem.initialize(LoggingInitializationContext, String, LogFile) to reduce
logging noise until the system has been fully initialized.beforeInitialize in class Slf4JLoggingSystempublic void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile)
LoggingSysteminitialize in class AbstractLoggingSysteminitializationContext - the logging initialization contextconfigLocation - a log configuration location or null if default
initialization is requiredlogFile - the log output file that should be written or null for
console only outputprotected void loadDefaults(LoggingInitializationContext initializationContext, LogFile logFile)
AbstractLoggingSystemloadDefaults in class AbstractLoggingSysteminitializationContext - the logging initialization contextlogFile - the file to load or null if no log file is to be writtenprotected void loadConfiguration(LoggingInitializationContext initializationContext, String location, LogFile logFile)
AbstractLoggingSystemloadConfiguration in class Slf4JLoggingSysteminitializationContext - the logging initialization contextlocation - the location of the configuration to load (never null)logFile - the file to load or null if no log file is to be writtenprotected void reinitialize(LoggingInitializationContext initializationContext)
AbstractLoggingSystemAbstractLoggingSystem.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 in class AbstractLoggingSysteminitializationContext - the logging initialization contextpublic Set<LogLevel> getSupportedLogLevels()
LoggingSystemLogLevels that are actually supported by the
logging system.getSupportedLogLevels in class LoggingSystempublic void setLogLevel(String loggerName, LogLevel logLevel)
LoggingSystemsetLogLevel in class LoggingSystemloggerName - 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)public List<LoggerConfiguration> getLoggerConfigurations()
LoggingSystemLoggingSystem's
loggers.getLoggerConfigurations in class LoggingSystempublic LoggerConfiguration getLoggerConfiguration(String loggerName)
LoggingSystemLoggingSystem's logger.getLoggerConfiguration in class LoggingSystemloggerName - the name of the loggerpublic Runnable getShutdownHandler()
LoggingSystemRunnable that can handle shutdown of this logging system when the
JVM exits. The default implementation returns null, indicating that no
shutdown is required.getShutdownHandler in class LoggingSystemnullpublic void cleanUp()
LoggingSystemcleanUp in class Slf4JLoggingSystemCopyright © 2019 Pivotal Software, Inc.. All rights reserved.