generateAndLogMsg()

Generates a message and sends it to 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 to identify the message severity:

 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. It generates a message from a message file and then sends it to the log destination. You establish the name of a connector's log destination through the Logging section in the Trace/Log File tab of Connector Configurator.

Important:
By combining these two methods, generateAndLogMsg() 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.
WebSphere InterChange Server

If severity is XRD_ERROR or XRD_FATAL and the connector configuration property LogAtInterchangeEnd is set, the error message is logged and an email notification is sent when email notification is on. See the System Administration Guide in the IBM WebSphere InterChange Server documentation set for information on how to set up email notification for errors.

IBM recommends that log messages be contained in a message file and extracted with the generateAndLogMsg() method. This message file should be the connector message file, which contains messages specific to your connector.

Connector messages logged with generateAndLogMsg() are viewable using LogViewer.

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; 
 }
 

See also

generateAndTraceMsg(), generateMsg(), logMsg()

Copyright IBM Corp. 1997, 2003