Link to the Information Technology Laboratory Website Link to the Information Access Division Website Link to the NIST Website NIST, IAD Banner

The Log System

A convenient log system was necessary to monitor distributed applications.

Adding redirections to the log output

The NDFS-II provides log information from servers, duplicators and client nodes. These pieces of information can be very useful to identify problems in applications or to display status information. The log outputs are by default sent to the standard output stream and the Control Center, but it is also possible to redirect the log output to:

  • a file. Each server, client node or duplicators has one log file.

  • the system logger of your operating system.

Enabling log outputs is done from the command line or the Control Center. From the command line, when launching a client node or the server, add parameters to specify redirections:

  • To log to a file, add --sf logfile=/the/full/path/of/the/file. The log of the server or client node will be saved in the file indicated using an absolute path. When logging into a file is activated for a server, the file logging is as well activated for duplicators. The log files for duplicators are stored in the same folder as where the server saves its log. The files are named dup_IdOfTheFlow-TypeOfTheFlow.log. For example, if a client node creates a flow of type Flow_Audio_Array with the connection ID mic1. The log file of the duplicator handling this flow is named dup_mic1-Flow_Audio_Array.log.

  • To log to the system logger, add --sf syslog=1 when you launch a server or a client node. The log options for the server are propagated to duplicators running on the same host.

Note: If you don't want to gather the logs from the Control Center, you need to disable this capability when launching data flow servers or client nodes. It can be done by giving this extra parameter to the data flow server or client nodes:

--sf logforward=0 

Changing the log severity

The log severity can also be set up when launching servers or client nodes. The severity level applied to a server will also be applied to the duplicator running on the same host. The severity of each client node can be set up individually.

Here are the 3 error levels in detail ascending order:

  • error: this is the default mode. Only errors and important messages are displayed.

  • warning: This mode is providing more output information.

  • debug. This mode provides very detailed information. It is intended for developers.

In order to change the default log severity, you need to specify it when starting a server or a client node. Adding the loglevel parameter on the command line does it. In the example below, the client is started with the debug severity.

consumer1 --sf clientname=new name --sf loglevel=debug

Enabling the Log redirection from threads

By default, the log forwarding capabilities are only available within the thread where the Smartflow object has been created. If a user creates a thread and wish to have the log generated from this thread available for viewing in the Control Center, then it is necessary to explicitely activate this capability. This can be done by calling the method Log_Manager::enableLogForwardForCurrentThread() within the thread context:

//sf is the Smartflow object

Before leaving the thread, the log forward should be deactivated by calling Log_Manager::disableLogForwardForCurrentThread().

Note: The method need to be invoked from each user thread in order to activate the log forwarding for each thread.

Using the log macro in your client node

It is possible for the user to use the log capabilities of the NDFS-II for his own usage within a client node. By doing so, logs generated from client nodes will therefore be visible from the Control Center, and be stored in a file or sent to the system logger if required.

We use the ACE logging capabilities to implement the NDFS-II log system, hence the method is actually an ACE macro.

ACE_DEBUG( (USER_PREFIX ACE_TEXT("The message displays a string: %s and an integer: %d\n"),
            myString, myInteger) );

The formatting directives used (%d, %s…) are mostly similar to the one used by the standard printf() function. For more specific formatting directive, please have a look at the ACE documentation.

Created on 2008-06-18 by Antoine Fillinger - Last updated on 2008-11-23 by Antoine Fillinger