public final class IfsLogManager extends Object
Has a singleton instance which all IfsLoggers register with. This instance performs logging system initialzation and manages log levels dynamically.
Modifier and Type | Method and Description |
---|---|
void |
addLogger(IfsLogger logger)
Add a logger.
|
void |
clearCachedEffectiveLevels()
Clear all the cached log levels for all registered IfsLoggers.
|
Level |
getEffectiveLevel(IfsLogger logger)
Get the effective level for the specified Logger.
|
IfsLogger |
getLogger(String loggerName)
Get the IfsLogger by name.
|
static IfsLogManager |
getLogManager()
Get the singleton instance of this class.
|
String |
getRootLoggerName()
Gets the root logger name, established during initialization.
|
void |
initialize(LogConfiguration logConfig,
boolean overwrite)
Initialize logging based on a LogConfiguration object.
|
boolean |
isInitialized()
Gets whether logging has been initialized completely.
|
void |
setLogLevel(String loggerName,
Level level)
Sets a log level.
|
public static IfsLogManager getLogManager()
public void initialize(LogConfiguration logConfig, boolean overwrite)
logConfig
- a LogConfiguration that specifies logging options.overwrite
- whether to replace the existing configurationpublic boolean isInitialized()
public String getRootLoggerName()
public void addLogger(IfsLogger logger)
logger
- The IfsLogger to add.public IfsLogger getLogger(String loggerName)
loggerName
- String containing the name of the logger.public void setLogLevel(String loggerName, Level level)
The specified loggerName can be the name of a specific class or a package name.
loggerName
- The logger namelevel
- the effective log level for this logger namepublic Level getEffectiveLevel(IfsLogger logger)
If not cached, delegate request to the IfsLogManager, which will choose the closest explicitly set log level, using the root logger's level as a last resort.
logger
- The IfsLogger to checkpublic void clearCachedEffectiveLevels()
Copyright © 2023. All rights reserved.