DUECA/DUSIME
Log message generation and control log

An overview of the facilities for creating log messages.

In order to display and record log messages on significant events in DUECA programs, a set of log macros is defined. To the programmer, these macros present an easy way of printing a message; by simply following the conventions for printing in C++. These messages are both printed on the standard error output of a DUECA program, but they are also sent, collected and recorded centrally within the DUECA process. Each message is also coded with file name and line within the file, so that a programmer can quickly find where the message was generated.

The following logging classes are defined:

In addition, a number of categories are defined. The normal category used by application programmers is MOD, indicating messages from a DUECA module. DUECA itself distinguishes the following:

A log command would look like a normal function call, as an example, here a message from the ChannelReplicator in the dueca-inter library:

/* DUECA interconnect.
There is a difference in definition of a DCO data class
between the current node and a remote node. Fix the code,
probably by running an update and recompile, ensure the DCO
definitions are identical. */
E_INT("data class magic for " << *ci << " differs with node " << node);

For development, C macros

Logging macros are accessible by including DUECA's debug.h header:

#include <debug.h>

By default, warning and error level messages are switched on, but debug and information level messages are suppressed. This means that the code to generate the message is inserted in a DUECA program, but by default "hitting" a logpoint will not generate a message. When developing, it is often useful to have more log information. You can select the default state of logging in a particular C++ file by providing C defines for the logging macros, which will be replaced by the debug.h header, for example:

#define D_MOD
#define I_MOD
#include <debug.h>

Now the D_MOD and I_MOD macros are defined to produce logging (as before), but they will by default be "active" for this source file, i.e., produce logging messages rather than be silent. Using the logging interface (see next section), the logging levels of the different log categories can be overridden during runtime.

From the log window

The second tab on the log messages window (Access this from the DUECA interface view menu), enables you to change the log level, per category and per node. In this way you can enable more detailed logging, or suppress messages. Once you do this, you will also override any initial log level settings you modified with the macros.

With an initial log level file

If DUECA finds a file dueca-initlog.xml in its startup folder, it will read that file and modify log levels according to the instructions in there. The file is XML-based, and has contents like:

<?xml version="1.0"?>
<loglevels>
<object class="LogLevelCommand">
<member name="node">
<value>0</value>
</member>
<member name="level">
<value>Debug</value>
</member>
<member name="category">
<value>MOD</value>
</member>
</object>
</loglevels>

It can contain any number of LogLevelCommand objects, which modify the log level for logging a specific category in a specific node. The level can be Debug, Info, Warning or Error.

The log output is available in a number of different places:

Here is a list of all log messages in DUECA's libraries.