OONF Logging

From OLSR.org Wiki
Jump to navigationJump to search

The OLSR.org Network Framework contains a flexible but lightweight logging system which collects logging messages annotated with their source, severity, timestamp and position in the source code and send them to one or multiple logging targets.


Each OONF Plugin defines one or multiple Logging Sources.

For each of this Sources there are three possible Severity Levels called Warning, Info and Debug.

There can be one or multiple logging Targets, each of them takes all logging output and put it somewhere.

The user can select up to which level of Severity each Source produce and which Targets should handle the output.

Logging Severity Levels

OONF uses three severity levels of logging.

Warning is the highest severity level, it will always be logged and cannot be switched of. Warning logging means something has gone wrong, sometimes in a non-recoverable way.

Info gives the user some information about important events, they can be switched on and off.

Debug gives a lot of information about API calls and state changes. Activating too many debug severity logging can easily overwhelm the user.

Logging Sources

Each OONF subsystem has its own logging source, where it dumps (typically) all its logging output. Some complex plugins (e.g. NHDP and OLSRv2) have more than one logging source.

The user does activate a logging source by setting the name of the source in the debug or info setting in the log configuration section.

Logging Targets

Logging targets take the logging output activated by the user and present it to the user in some way. There can be multiple active logging targets at the same time.

The OONF Core provides three Logging Targets:

  • stderr prints out all logging messages through stderr
  • syslog sends all logging messages to the system logfile.
  • file saves all logging messages in a file.

Logging Configuration

The configuration of the logging system is done through a configuration section called log.

There are five configuration settings in the log section.

Key Type Default
debug list of CHOICE
info list of CHOICE
stderr BOOL false
syslog BOOL false

debug and info ask for a list of Logging Sources that will be logged by the OONF Core Logging Targets.

stderr and syslog are boolean options that activate or deactivate the stderr and syslog Logging Target.

file asks for a filename for logging output. Setting the filename also activates file logging.

If you do not any of the three Logging Targets of the OONF Core, it will activate the stderr Target by default.

You can look up the exact settings by using the --schema command line option:

./olsrd2_static --schema=log

Dynamic Logging during runtime

The Remotecontrol Plugin allows to setup an independent set of filters for the Logging Sources and watch the stream of logging messages through the OONF Telnet Plugin.