[Olsr-dev] New OLSR logging infrastructure

Henning Rogge (spam-protected)
Sun Mar 22 16:21:40 CET 2009


On Sonntag 22 März 2009 12:41:22 you wrote:
> Hello,
>
> I'm in the final part of ripping the old "debug level" based logger out of
> the development tip and replace it with a better system. I will write a
> summary about the new system soon, but at the moment the Windows version of
> Olsr.org will not compile (I don't have the neccesary toolchain). I will
> try to fix it today, but I cannot test it.

Okay, everything is in place (win32 untested), so here is a description of the 
changes in the logging infrastructure:

In the past OLSR had four different kind of logging mechanisms:
- direct output to stdout
- direct output to stderr
- syslog
- OLSR_PRINTF

Even if OLSR_PRINTF (a macro) was designed to be the "official" way to print 
something for debugging, many function used the other methods so there was no 
easy way to know where the debugging output would be.

In addition to this OLSR_PRINTF had problems of it's own. All debugging output 
was sorted by a "debug level", which simply was an integer between 0 (nearly 
no output) to 10+ (LOTS of output). Of course the numbers for certain outputs 
were changed several times during programming, most times you had either not 
enough info or too much.

The new debugging API has four different SEVERITY LEVELS:
- DEBUG (lot's of output, mostly useless for normal users)
- INFO (output about the internal state)
- WARN (something is wrong, but the routing agent will continue)
- ERROR (something BAD happened, programm is ending)

In addition to this each debugging output has a SOURCE, which specifiy some 
logical part of the routing agent. The new API allows you to specify which of 
the four levels you are interested for each source.

Finally you can specify one or multiple LOGGING TARGETS. At the moment you can 
send them to stderr, to a file and/or into the syslog.



Command line parameters/Config options to control the new logger:
=================================================================
--log_debug=<source1,source2,...>
--log_info=<source1,source2,...>
--log_warn=<source1,source2,...>
--log_error=<source1,source2,...>

These four options allow you to specify the sources you are interested with a 
certain severity level. If you don't specifiy a severity level, you will 
automatically get all options specified for "lower" levels.
(if you set "--log_info links" but not "--log_warn/error..." then you get 
warnings and errors for "links" too)

--log_stderr           activate logging to stderr
--log_syslog           activate logging to syslog
--log_file=<file>      activate logging to a file

These three options can be combined.

--help log             Displays a list of all available logging options

-d <num> or --debug=<num>

The old debug level was redesigned to allow easy access to some default 
logging configurations.

"-d -2" will suppress ALL logging output.
"-d -1" will only show errors.
"-d 0" will output warnings and errors.
"-d 1" outputs warning and errors, In addition to this it outputs info for the 
sources "main", "links", "neighbors", "2-hop", "plugins", "routing" and "tc". 
It tries to emulate the old option "-d 1".
"-d 2" will output all info, warnings and errors
"-d 3" will output ALL logging information (LOTS of output !)

If you don't set any logging options at all you will get "-d 0" as default.

Comments, Critics and ideas welcome !

Henning

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20090322/56d882be/attachment.sig>


More information about the Olsr-dev mailing list