Applications should implement an option to
enable trace. You can control tracing in ECI and ESI Version 2 applications
using the functions and environment variables described here.
You can set trace level, file, data length and offset
either by using a function call or by setting an environment variable.
Examples of each are shown below. To avoid having to recompile applications,
enable trace by setting the environment variable.
Trace level
You can set 5 trace levels:
- CTG_TRACE_LEVEL0
- Disables all tracing. This is the default setting.
- CTG_TRACE_LEVEL1
- Enables exception trace points. This level of tracing can be set
on permanently to provide an error log capability. Messages are written
only for system errors, socket errors, and other Gateway connection
errors.
- CTG_TRACE_LEVEL2
- Enables event trace points and those from lower trace levels.
- CTG_TRACE_LEVEL3
- Enables function entry and exit trace points and those from lower
trace levels.
- CTG_TRACE_LEVEL4
- Enables debug trace points and those from lower trace levels.
Here is an example of the trace level function call:
CTG_setAPITraceLevel(CTG_TRACE_LEVEL1);
Here
is an example of the trace level environment variable:
CTG_CLIENT_TRACE_LEVEL=1
Trace file
The default trace destination is
the standard error stream.
Here is an example of the trace file
function call:
CTG_setAPITraceFile("filename.trc");
Here
is an example of the trace file environment variable:
CTG_CLIENT_TRACE_FILE=filename.trc
If
the trace file is not set, trace is written to the standard error
stream (stderr).
Trace data length
The trace data length specifies
the maximum amount of data that is written to trace when communicating
with CICS® Transaction Gateway
and the trace level is set to CTG_TRACE_LEVEL4. The default setting
is 128 bytes.
Here is an example of the trace data length function
call:
CTG_setAPITraceDataLength(256);
Here
is an example of the trace data length environment variable:
CTG_CLIENT_DATA_LENGTH=256
Trace data offset
The trace data offset specifies
an offset into data where tracing begins. When combined with the trace
data length this allows a specific section of data to be traced, for
example a section of data in a COMMAREA. The default setting is zero.
Here is an example of the trace data offset function call:
CTG_setAPITraceDataOffset(40);
Here
is an example of the trace data offset environment variable:
CTG_CLIENT_DATA_OFFSET=40