generateAndTraceMsg()

Generates a trace message from a set of predefined messages in a message file and sends the generated trace message to the connector's log destination.

Syntax

void generateAndTraceMsg(int msgNum, int msgType, int traceLevel, 
      int argCount, ...);

Parameters

msgNum [in]
Specifies the message number (identifier) in the message file.

msgType [in]
Is one of the following message-type constants defined in the CxMsgFormat class:

XRD_WARNING 

 
XRD_ERROR 

 
XRD_FATAL 

 
XRD_INFO 

 
XRD_TRACE 

traceLevel
Is one of the following trace-level constants to identify the trace level used to determine which trace messages are output:

CWConnectorUtil.LEVEL1

 
CWConnectorUtil.LEVEL2

 
CWConnectorUtil.LEVEL3

 
CWConnectorUtil.LEVEL4

 
CWConnectorUtil.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.

argCount [in]
Is an integer that specifies the number of parameters within the message text.

... [in]
Is a list of message parameters for the message text.

Return values

None.

Notes

The generateAndTraceMsg() method combines the functionality of the generateMsg() and traceWrite() methods. By combining these two methods, generateAndTraceMsg() frees up the memory required for the message string that generateMsg() produces. You no longer need to include the call to the freeMemory() method to release the memory allocated for the message string.

Note:
The generateAndTraceMsg() method is also available in the GenGlobals class. It is provided in the BOHandlerCPP class for access to tracing from within the business object handler.

Examples

if(tracePtr->getTraceLevel()>= Tracing::LEVEL3) {
   // Message 3033 - Opened main form for object
   msg = generateAndTraceMsg(3033,CxMsgFormat::XRD_FATAL,
      Tracing::LEVEL3,0, NULL);
}

Copyright IBM Corp. 1997, 2004