@ConfigurationDescription(properties={@Property(name="Logging.Instances.ConsoleLogger",defaultNull=true,documentationOnly=true,description="This is a global configuration and not specific to a LoggerManager. A list of instances for a console logger. All of these loggers will print to console. Note that the order of the log messages of different loggers may be arbitrary and even interleaved."),,,,,,,,}) public abstract class LoggerManager extends java.lang.Object
Logging.Instances.ConsoleLogger (ConfigurationConstants.PREFIX_PROPERTY_REGISTRY_INSTANCES,
ConfigurationConstants.COMPONENT_TYPE_CONSOLE_LOGGER)<ConsoleLoggerInstance>.Root<ConsoleLoggerInstance>.Level<ConsoleLoggerInstance>.Filter.RootLogging.Instances.FileLogger (ConfigurationConstants.PREFIX_PROPERTY_REGISTRY_INSTANCES,
ConfigurationConstants.COMPONENT_TYPE_FILE_LOGGER)FileLogger.LogDirectory (ConfigurationConstants.COMPONENT_TYPE_FILE_LOGGER)<FileLoggerInstance>.Root (ConfigurationConstants.LOGGER_CONFIGURATION_ROOT)<FileLoggerInstance>.Level (ConfigurationConstants.LOGGER_CONFIGURATION_LEVEL)<FileLoggerInstance>.FileSize (ConfigurationConstants.LOGGER_CONFIGURATION_FILE_SIZE)<FileLoggerInstance>.FileCount (ConfigurationConstants.LOGGER_CONFIGURATION_FILE_COUNT)<FileLoggerInstance>.CSVMode (ConfigurationConstants.LOGGER_CONFIGURATION_CSV_MODE)<FileLoggerInstance>.Filter.Root| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.util.logging.Logger,Pair<java.util.logging.Level,java.util.Collection<java.util.logging.Handler>>> |
configuredLoggers
All loggers that have a special configuration.
|
protected static java.util.logging.Logger |
ourLogger
The logger for log messages when initialising all loggers.
|
| Constructor and Description |
|---|
LoggerManager(boolean keepHandler,
boolean debugLogging)
Creates a new logger manager and
initialises debug
logging which applies until the console logging is
initialised.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
adjustLogLevel(java.util.logging.Level newLevel,
java.util.logging.Logger logger)
Adjusts the log level of the logger.
|
protected abstract java.util.logging.Formatter |
createFormatter(boolean csvMode)
Creates a formatter for a logger.
|
protected void |
initialiseConsoleLogging(Configuration configuration)
Initialises the console logging based on the designated configuration.
|
protected void |
initialiseFileLogging(Configuration configuration,
java.io.File globalLogDir)
Initialises the file logging based on the designated configuration.
|
void |
resetLogger()
Resets the configured loggers to their initial values and removes them from
the map.
|
protected static final java.util.logging.Logger ourLogger
protected final java.util.Map<java.util.logging.Logger,Pair<java.util.logging.Level,java.util.Collection<java.util.logging.Handler>>> configuredLoggers
LogManager only keeps weak references to loggers. This way, loggers may be
garbage-collected after they have been configured but before they are
really used. public LoggerManager(boolean keepHandler,
boolean debugLogging)
keepHandler - Whether to keep already registered log handlers.
Otherwise all registered log handlers will be removed.debugLogging - Whether debug logging should be enabled, that is, all
log messages before initialising the logging will be printed to
console.protected void initialiseConsoleLogging(Configuration configuration)
configuration - The configuration containing the parameters for the
console loggers, handlers and filters.protected void initialiseFileLogging(Configuration configuration, java.io.File globalLogDir) throws ConfigurationException
configuration - The configuration containing the parameters for the
file loggers and handlers.globalLogDir - The directory for the logs which will be used if the
designated configuration does not provide a log directory.ConfigurationException - If the directory for storing the logs can
not be created or it is a file, a
ConfigurationException will be thrown.protected abstract java.util.logging.Formatter createFormatter(boolean csvMode)
csvMode - Whether the formatter is for a CSV log with additional
AristaFlow-specific information when logging.CSVFormatterpublic static void adjustLogLevel(java.util.logging.Level newLevel,
java.util.logging.Logger logger)
newLevel - The new level for the logger.logger - The logger for which to adjust the log level.public void resetLogger()