Logger provides an API for event logging to TE Subsystems, Test Agents and tests (if Test Agent runs on an operating system with shared address space, logging facilities may be provided to tested software as well).

Logger stores log messages in a binary file in raw format that can be later converted to XML, HTML and plain text as well as filtered.


Logger context in TE

Logger passively accumulates log messages in raw log file when they are generated by Test Engine components by means of Logger API. From the other hand log messages generated in Test Agent context accumulated on Test Agent side by Logger Test Agent library until Logger asks for a bulk of messages (via RCFOP_GET_LOG RCF operation).

Each Test Agent is polled by Logger in regular time intervals in order to gather accumulated log messages (bulk of messages). Polling interval can be configured for each Test Agent in Logger configuration file.

Even though Logger exports two libraries - for Test Engine side (sources can be found under ${TE_BASE}/lib/loggerten directory) and Test Agent side (sources can be found under ${TE_BASE}/lib/loggerta directory), from users point of view there is no difference which library is in use because API: Logger hides all the differences.

Logger defines a number of log levels that gradate log messages by their importance. According to log levels Logger exports a number of macros to be used by any TE entity. These macros have printf-like arguments (format string and format arguments):

Log level is a compile-time value – low log level leads to removing macro calls by the pre-processor. ERROR, WARN and RING are enabled by default.

Apart from C function API, Logger provides script-based mechanism for logging to use by Dispatcher and Builder. This interface is necessary to support logging during initialization (when TEN components haven’t been started yet):

  • te_log_init - script to initialize logging facility;

  • te_log_message - script to use for logging from scripts.

Configuration File

Logger has its own configuration file that can be used to specify:

  • polling interval to use by Logger while gathering log messages from te_agents. It is possible to specify default interval that is applied to all te_agents as well as intervals for the particular Test Agent or for a goup of Agents of the same type;

  • sniffer configuration settings.

For example the simplest Logger configuration file would look like the following:

# polling value unit is milli seconds.
        _default: 100

If you need to specify polling intervals on per Test Agent basis or on per Agent type value you need to write something like:

# polling value unit is milli seconds.
# specify polling interval on per Test Agent name basis
            _agent: Agt_A
            _value: 200
# specify polling interval on per Test Agent type basis
            _type: unix
            _value: 300
    _default: 100

Log messages

Each log message is associated with:

  • timestamp - time value when a log was registered in Logger;

  • level - the value that reflects importance of the message;

  • entity name - identifies Test Engine process which logs the message (Remote Control Facility (RCF), Tester, test name, etc.) or TA where the message was generated;

  • user name - identifies any logical part of the process like RCF API library, Configurator API library or agent configuration module. Each library must have its own logger user name;

Example of log message (in text format):

ERROR  Tester  Run Path  16:15:50 592 ms
Test path requested by user not found.
Path: foobar-ts/foo_package/mytest

All log messages accumulated by Tester into tmp_raw_log file that is by default put under a directory from which Dispatcher script is called. The directory where to put tmp_raw_log file can be overwritten specifying –log-dir option to Dispatcher.

Report Generator Tool should be used to convert raw logs into different formats. Conversion may be done in live or postponed modes.

Live mode is suitable to use when it is necessary to get log output in the text format on the fly. Dispatcher command-line option –live-log should be used to get logs on the fly.

In postponed mode raw log is first converted to XML format (structured, time ordered) and then XML file can be converted to HTML or text format log.

To ask Dispatcher prepare HTML version of the log you should pass –log-html=[output dir name] option in command line. Then Dispatcher generates HTML pages under specified [output dir name] directory.