Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Interface Runtime Tracing and Logging

Trace Features

The Interface Runtime Library can generate trace output to support defect analysis and debugging. The trace is usually written to a file, and the size of that file can be limited (and the trace starts writing at the beginning of the file when the size is exceeded). Also, the trace is multi-thread safe, and thread changes are detected and logged.
The following kinds of trace can be generated:

Call Trace
The call trace (or short trace) trace is a hierarchical trace that shows the names of the internal methods as they get called. Only the names are shown, not the arguments of the calls. The function names are indented to show the call nesting level.
Debug Trace
All explicit trace statements in the Interface Runtime fall into this category. Thus you will see here all additional diagnostic output, to diagnose problems in using the interface runtime.
Profile Trace
In this trace, the entering and exiting of a profiling sections (which are usually, but are not necessarily required to be functions) is traced with a timestamp of high resolution. That output can be used to gather profiling data about the runtime behaviour.
Packet Trace
In this trace, the content of the packets which are sent to and received from the database server is dumped.

Controlling the Trace

The trace can be enabled by two methods:
Trace Control via Environment Variable
The trace options can be controlled by setting the environment variable SAPDB_IFR_TRACEOPTIONS before the application is running. The individual options are separated by double-colons. The following options are provided:

Option Description
o<filename> The output file name. An output file name of '-' means standard output. A %p in the file name is replaced by the process id, so different processes can use the settings without overwriting each other's trace. If the file name shall contain a double-colon, you have to repeat it (e.g. oc::\trace.txt).
c<limit> Enable the call trace, with a recursion limit of <limit>. Calls more nested than <limit> are not traced, as default the recursion limit is not limited, if it is not specified.
p<limit> Enable the packet trace. The size of individual packet content that is dumped is limited by <limit>, which is 1000 bytes as default.
g Enable the profiling trace.
d Enable the debug trace.
T Enable the timestamp prefix in front of each output line
s<size> Limit the size of the trace file to <size> bytes. As default, the size of the trace file is not limited. If the trace exceeds <size>, the file is overwritten starting at the beginning.

Trace Control using ifr_cons
If the use of the environment variable is not feasible (as a process was already started, and so the environment cannot be set), the tool ifr_cons can be used to enable or disable trace options.

The tool ifr_cons is called as follows:

          
ifr_cons [options] [command]
where [options] are:

Option Description
-f <filename> Use <filename> as the name of the shared memory lock file. If no file is supplied, the file specified in the environment variable SAPDB_IFR_SHAREDMEM is used. If that environment variable is not set, the file irtrace.shm in the independent protocol path will be used.
-h Help. Shows usage information, and ignore all commands.
-p <pid> Execute the command only for the specified process id <pid>.
-v Verbose operation.

and [commands] are:

Command Description
TRACE CALL|SHORT ON|OFF|<limit> Switches the call trace on or off or sets the call trace nesting level
TRACE DEBUG ON|OFF Switches the debug trace on or off
TRACE LONG ON|OFF Switches the long trace (call plus debug trace) on or off
TRACE PROFILE ON|OFF Switches the profile trace on or off
TRACE PACKET ON|OFF|<limit> Switches the packet trace on or off or sets the packet trace size.
TRACE TIMESTAMP ON|OFF Switches the time stamp prefix on or off
SHOW TRACESETTINGS Shows the current trace settings done by this tool.

All command names are case insensitive. Also commands can be abbreviate to a length where they can uniquely identified (e.g. 'S T' is same as 'SHOW TRACESETTINGS').