Version 9.6
 —  Administration of EntireX under BS2000/OSD  —

Command Logging in EntireX

Command logging is a feature to assist in debugging Broker ACI applications. A command in this context represents one user request sent to the Broker and the related response of Broker.

Command logging is a feature that writes the user requests and responses to file in a way it is already known with Broker trace and TRACE-LEVEL=1. But command logging works completely independent from trace, and data is written to a file only if defined command trace filters detect a match.

Broker stub applications send commands or requests to the Broker kernel, and the Broker kernel returns a response to the requesting application. Developers who need to resolve problems in an application need access to those request and response strings inside the Broker kernel. That's where command logging comes in. With command logging, request and response strings from or to an application are written to a file that is separate from the Broker trace file.

This document covers the following topics:


Introduction to Command Logging

This section provides an introduction to command logging in EntireX and offers examples of how command logging is implemented. It covers the following topics:

Overview

Command logging is similar to a Broker trace that is generated when the Broker attribute TRACE-LEVEL is set to 1. Broker trace and command logging are independent of each other, and therefore the configuration of command logging is separate from Broker tracing.

The following Broker attributes are involved in command logging:

Attribute Description
CMDLOG Set this to "N" if command logging is not needed.
CMDLOG-FILE-SIZE A numeric value indicating the maximum size of command log file in KB.
NUM-CMDLOG-FILTER The maximum number of filters that can be set.

In addition to CMDLOG=YES, the Broker needs the assignment of the dual command logging files during startup. If these assignments are missing, Broker will set CMDLOG=NO. See also Broker Attributes.

Command Log Files

The Broker keeps a record of commands (request and response strings) in a command log file.

At Broker startup, you will need to supply two command log file names and paths. Only one file is open at a time, however, and the Broker writes commands (requests and responses) to this file.

When the size of the active command log file reaches the KB limit set by CMDLOG-FILE-SIZE, the file is closed and the second file is opened and becomes active. When the second file also reaches the KB limit set by CMDLOG-FILE-SIZE, the first file is opened and second file is closed. Existing log data in a newly opened file will be lost.

Defining Filters

In command logging, a filter is used to store and identify a class, server, or service, as well as a topic name and user ID.

Use the System Management Hub to define a filter. . During processing, the Broker evaluates the class, server, service, topic, and user ID associated with each incoming request and compares them with the same parameters specified in the filters. If there is a match, the request string and response string of the request is printed out to the command log file.

Programmatically Turning on Command Logging

Applications using ACI version 9 or above have access to the new field LOG-COMMAND in the ACI control block.

If this field is set, the accompanying request and the Broker's response to this request is logged to the command log file.

Note:
Programmatic command logging ignores any filters set in the kernel.

Top of page

ACI-driven Command Logging

EntireX components that communicate with Broker can trigger command logging by setting the field LOG-COMMAND in the ACI control block.

When handling ACI functions with command log turned on, Broker will not evaluate any filters. Application developers must remember to reset the LOG-COMMAND field if subsequent requests are not required to be logged.

Top of page

Dual Command Log Files

Broker's use of two command log files prevents any one command log file from becoming too large.

When starting a Broker with command log support, you must therefore specify two file names and paths - one for each of the two command log files. The sample startup script installed with the product uses the variables ETB_CMDLOG1 and ETB_CMDLOG2 as the default command log file names.

At startup, Broker initializes both files and keeps one of them open. Command log statements are printed to the open file until the size of this file reaches the value specified in the Broker attribute CMDLOG-FILE-SIZE. This value must be specified in KB.

When the size of the open file exceeds the value specified in the Broker attribute CMDLOG-FILE-SIZE, Broker closes this file and opens the other, dormant file. Because the Broker closes a log file only when unable to print out a complete log line, the size of a full file may be smaller than CMDLOG-FILE-SIZE.

Top of page