trace()

Write a trace message to the log destination.

Syntax

void trace(String traceMsg)
 void trace(int traceLevel, String traceMsg)
 void trace(int traceLevel, int messageNum)
 void trace(int traceLevel, int messageNum, String param [,...])
 void trace(int traceLevel, int messageNum, Object[] paramArray)
 

Parameters

traceLevel
The tracing level that is used to determine which trace messages are output. The method writes the trace message when the trace level for the collaboration object is greater than or equal to this traceLevel value. You should define the trace levels for this collaboration and document them so that the administrator knows which level to use for the collaboration object.

traceMsg
The trace-message text that is written to the trace file.

messageNum
The message number of a message in the collaboration's message file, which is indexed by message number. For information on how to set up a message text file, refer to Creating a message file.

param
A value for a single message parameter. There can be up to five message parameters, separated by commas. Each is sequentially resolved to a parameter in the message text.

paramArray
An array of message-parameter values. Each is sequentially resolved to a parameter in the message text.

Notes

The trace() method sends a trace message to the collaboration's log destination. By default, the log destination is the file InterchangeSystem.log. You can change the log destination by entering a value for the LOG_FILE parameter in the InterChange Server configuration file, InterchangeSystem.cfg. The parameter value can be a file name or STDOUT, which writes the log to InterChange Server's command window.

You can also set three other system configuration parameters related to trace logging. All parameters are located in the configuration file, InterchangeSystem.cfg:

The trace() method has several forms:

A collaboration object can be configured to generate a system-generated trace or a collaboration-generated trace. The trace() method generates a message that the collaboration object prints if configured to print a collaboration-generated trace. For help in deciding when to use tracing, refer to "Adding trace messages".

Examples

The following example uses the second form of the method to generate a Level 2 trace message with the supplied text of the message:

trace (2, "Starting to trace at Level 2");
 

The following example uses the fourth form of the method to write message 201 in the collaboration's message file, if the collaboration object trace level is 2 or higher. The message has two parameters, a name and a year, for which this method call passes values.

trace(2, 201, "DAVID", "1961"); 
 

Copyright IBM Corp. 2003, 2004