generateAndTraceMsg()

Generates a trace message and sends it to the connector's trace 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 [in]
is one of the following trace-level constants defined in the Tracing class to identify the trace level used to determine which trace messages to 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.

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 message generating and tracing functionality of generateMsg() and traceWrite(), respectively. It generates a message from a message file and then sends it to the trace destination. You establish the name of a connector's trace destination through the TraceFileName connector configuration property.

Important:
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.

Connector messages logged with generateAndTraceMsg() are not viewable using LogViewer.

Examples

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

See also

generateAndLogMsg(), generateMsg(), traceWrite()

Copyright IBM Corp. 1997, 2003