generateAndLogMsg()

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

Syntax

void generateAndLogMsg(int msgNum, int msgType, 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 
 

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 generateAndLogMsg() method combines the functionality of the generateMsg() and logMsg() methods. By combining these two methods, generateAndLogMsg() frees up the memory required for the message string that generateMsg() produces.

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

Examples

The following example performs the same task as the example provides for the generateMsg() method:

ret_code = connect_to_app(userName, password);
 // Message 1100 - Failed to connect to application
 if (ret_code == -1) {
       msg = generateAndLogMsg(1100, CxMsgFormat::XRD_ERROR, 0, NULL);
       return BON_FAIL; 
 }
 

Copyright IBM Corp. 1997, 2003