Writes a trace message to the log destination. This is a
utility method for connector developers to use.
Syntax
void traceWrite(int traceLevel, char * info,
char * filterName);
Parameters
- traceLevel [in]
- Is one of the following
trace-level constants to identify the trace level used to determine
which trace messages are output:
Tracing::LEVEL1
Tracing::LEVEL2
Tracing::LEVEL3
Tracing::LEVEL4
Tracing::LEVEL5
The method writes the trace message when the current trace level
is greater than or equal to traceLevel.
- Note:
- Do not specify a trace level of zero (LEVEL0) with a
tracing message. A trace level of zero indicates that tracing is
turned off. Therefore, any trace message associated with a
traceLevel of LEVEL0 will never print.
- info [in]
- Is a pointer to the message text to use for the trace
message.
- filterName [in]
- Is a pointer to a filter to use for writing the message.
Specify NULL for this parameter.
Return values
None.
Notes
You can use the traceWrite() method to write your own
trace messages for a connector. Tracing is turned on for the
connector when the TraceLevel connector
configuration property is set to a nonzero value (any trace-level
constant except LEVEL0).
The traceWrite() method sends the specified
msg text to the trace destination when the current
trace level is greater than or equal to level. You
establish the name of a connector's trace destination through the
Tracing section in the Trace/Log File tab of Connector
Configurator.
Because trace messages are usually needed only during debugging,
whether trace messages are contained in a message file is left at
the discretion of the developer:
- If non-English-speaking users need to view trace messages, you
need to internationalize these messages. Therefore, you must put
the trace messages in a message file and extract them with the
generateMsg() method.
This message file should be the
connector message file, which contains message specific to your
connector. The generateMsg() method generates the message
string for traceWrite(). It retrieves a predefined trace
message from a message file, formats the text, and returns a
generated message string.
- Note:
- You can use the generateAndTraceMsg() method to
combine the message generation and logging steps.
- If only English-speaking users need to view trace messages, you
do not need to internationalize these messages. Therefore, you can
include the trace message (in English) directly in the call to
traceWrite(). You do not need to use the
generateMsg() or generateAndTraceMsg()
method.
Connector messages logged with traceWrite() are
not viewable using LogViewer.
Examples
traceWrite(Tracing::LEVEL3, "Invalid LoginId", NULL);
See also
generateAndTraceMsg(),
generateMsg()
See also the description of the Tracing class.
