2.6 Logging and Debugging

Normally, johd prints any errors, warnings and other diagnostic messages on standard error. You can, however, change this default and direct all diagnostic messages to syslog. To do so, specify the desired syslog facility with the ‘-F’ command line option. For example:

 
johd -F daemon

Allowed facility names for use with this option are: ‘user’, ‘daemon’, ‘auth’, ‘authpriv’, ‘mail’, ‘cron’, ‘local0’ through ‘local7’. All names are case-insensitive.

Notice, that when given the ‘-D’ option (see daemon), johd automatically assumes ‘-F daemon’, so you need not use the ‘-F’ option, unless, of course, you want to change the default facility.

Messages sent to syslog are prefixed by the program name. To change this prefix use the ‘-L’ option. Its argument will be used as a log tag to prefix each message with.

Each diagnostic message has a severity level associated with it. Severity levels are (in order of increasing severity): ‘debug’, ‘warning’, ‘info’, ‘error’, and ‘crit’. The latter is assigned to conditions which cause immediate termination of the program.

Normally, severity levels are not printed. To instruct johd to precede each message with its severity level, use the ‘-P’ option.

Debugging diagnostics is useful when you trace some difficult configuration problem or investigate a bug in johd itself. This diagnostics is printed only when the ‘-d’ option is given. The argument to the ‘-d’ option is the debugging level, an integer number ranging from 0 to 100. Level 0 effectively disables all debugging and is equivalent to not specifying ‘-d’ option at all. Subsequent levels produce increasing amount of debugging information. Finally, the level 100 prints dumps of network packets received and sent by johd.

Notice, that the use of the ‘-d’ option with levels greater than 10 requires a good knowledge about johd internals and slows down its operation, so use it sparingly, if at all.

When debugging johd it may be helpful to know where precisely in the source code each debugging message was generated. This information can be obtained using the ‘-i’ (source-info) option. When it is given, each debug message is additionally prefixed with the name of the source file and line number in it.