public abstract class LoggingSystem extends Object
Modifier and Type | Field and Description |
---|---|
static String |
NONE
The value of the
SYSTEM_PROPERTY that can be used to indicate that no
LoggingSystem should be used. |
static String |
ROOT_LOGGER_NAME
The name used for the root logger.
|
static String |
SYSTEM_PROPERTY
A System property that can be used to indicate the
LoggingSystem to use. |
Constructor and Description |
---|
LoggingSystem() |
Modifier and Type | Method and Description |
---|---|
abstract void |
beforeInitialize()
Reset the logging system to be limit output.
|
void |
cleanUp()
Clean up the logging system.
|
static LoggingSystem |
get(ClassLoader classLoader)
Detect and return the logging system in use.
|
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. |
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.
|
void |
setLogLevel(String loggerName,
LogLevel level)
Sets the logging level for a given logger.
|
public static final String SYSTEM_PROPERTY
LoggingSystem
to use.public static final String NONE
SYSTEM_PROPERTY
that can be used to indicate that no
LoggingSystem
should be used.public static final String ROOT_LOGGER_NAME
public abstract void beforeInitialize()
initialize(LoggingInitializationContext, String, LogFile)
to reduce
logging noise until the system has been fully initialized.public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile)
initializationContext
- 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 outputpublic void cleanUp()
public Runnable getShutdownHandler()
Runnable
that can handle shutdown of this logging system when the
JVM exits. The default implementation returns null
, indicating that no
shutdown is required.null
public Set<LogLevel> getSupportedLogLevels()
LogLevels
that are actually supported by the
logging system.public void setLogLevel(String loggerName, LogLevel level)
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)public List<LoggerConfiguration> getLoggerConfigurations()
LoggingSystem
's
loggers.public LoggerConfiguration getLoggerConfiguration(String loggerName)
LoggingSystem
's logger.loggerName
- the name of the loggerpublic static LoggingSystem get(ClassLoader classLoader)
classLoader
- the classloaderCopyright © 2018 Pivotal Software, Inc.. All rights reserved.