Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

Package de.lmu.ifi.dbs.elki.logging

Logging facility for controlling logging behaviour of the complete framework.

See:
          Description

Interface Summary
Loggable Interface providing the methods required to log messages according to LogLevel levels.
 

Class Summary
AbstractLoggable Abstract superclass for classes being loggable, i.e. classes intending to log messages.
DebugFilter A filter for all (or specified) logs - suitable for handling debugging messages.
ExceptionFilter A filter for exception logs - suitable for handling severe error messages.
ExceptionFormatter A formatter to format exception messages.
ImmediateFlushHandler ImmediateFlushHandler is a stream handler flushing each published LogRecord immediately.
InfoFilter A filter for info logs - suitable for handling verbose messages.
LoggingConfiguration Facility for configuration of logging.
LogLevel This class provides a set of logging levels that should be used to control logging output.
MaskingOutputStream An OutputStream to mask the underlying OutputStream.
MessageFilter A filter for message logs - suitable for handling messages.
MessageFormatter A formatter to simply retrieve the message of an LogRecord.
ProgressFilter A filter for progress logs - suitable for handling progress messages.
ProgressLogRecord Additionally to the functionality of a LogRecord, a ProgressLogRecord provides information concerning the progress as the name of the progressing task and the percentage of the progress.
SelectiveFilter A selective filter filters exactly for a certain LogLevel of LogRecords.
StaticLogger Subclass of AbstractLoggable , can be used in static environments.
WarningFilter A filter for warning logs - suitable for handling warning messages.
 

Package de.lmu.ifi.dbs.elki.logging Description

Logging facility for controlling logging behaviour of the complete framework.

Logging

Any classes intending to log message should extend AbstractLoggable.

Level specific logging

Handling

Level specific handling

Handling for Command Line Interface

Efficiency considerations (for development)

Coding the logging of debugging messages conditionally by a final boolean variable can result in a considerable speedup if the final boolean is false. This is the purpose of the recommendation given above, to specify a variable in each class that owns a logger:

private static final boolean DEBUG = LoggingConfiguration.DEBUG;
A debugging message can then get coded as follows:
if(DEBUG)
{
    debugFine("message\n"); // or: finer, finest
}
Most compilers will remove the code in the if-clause during compiling if it can be taken for sure that the condition will always be false (e.g. if it is a final boolean set to false). For class specific debugging, the developer will code the attribute as
private static final boolean DEBUG = true;
while for general debugging the developer could also set the central attribute LoggingConfiguration.DEBUG to true.

For reasons similar to debugging, the verbosity of an algorithm is restricted by a boolean variable rather than by choosing the granularity of loggers. Any verbose message for information of users is of the level LogLevel.VERBOSE. One could switch off the handler for verbose messages, but the logging of those messages will still be time consuming. Thus, the developer should log verbose messages also conditionally, like:

if(isVerbose())
{
    logger.verbose("message\n");
}

Configuration of logging behaviour

If a class uses its own main method, it is advisable to configure the loggers as follows:

if(LoggingConfiguration.isChangeable())
{
    LoggingConfiguration.configureRoot(LoggingConfiguration.CLI);
}
This ensures the behaviour of output of the log-entries to be consistent over the framework.

To perform this configuration could also be necessary in constructors of classes, if they are created befor any method is called that performs the logging-configuration already and logging is used within the constructor.

If the logging configuration should not be changed in the following (e.g. in case of a graphical user interface, that sets GUI-related handlers), one uses:

LoggingConfiguration.configureRootFinally(LoggingConfiguration.GUI);


Release 0.1 (2008-07-10_1838)