Use cciUserDebugTrace to write a message from a message catalog (with inserts) to user trace when user trace is active at debug level.
If user trace is not active at debug level, an entry is written to service trace when service trace is active.
void cciUserDebugTrace(
int* returnCode,
CciObject* object,
const CciChar* messageSource,
int messageNumber,
const char* traceText,
...
);
To use the current broker message catalog, specify BIPmsgs on all operating systems. Alternatively, you can create your own message catalog.
When trace is formatted, a message from the NLS version of this catalog is written.
The locale used is that of the environment where the trace is formatted. You can run the broker on one operating system, read the log on that operating system, then format the log on a different operating system. For example, if the broker is running on Linux, UNIX, or z/OS but no .cat file is available, you could read the log, then transfer it to Windows where the log can be formatted by using the .properties file.
If this parameter is NULL, the effect is the same as specifying an empty string. That is, all other information is written to the log, and the catalog field has an empty string value. Therefore, the log formatter cannot find the message source and fails to format this entry.
None. If an error occurs, the returnCode parameter indicates the reason for the error.
const CciChar* myMessageSource=CciString("SwitchMSG",BIP_DEF_COMP_CCSID);
CciNode* thisNode = ((NODE_CONTEXT_ST*)context)->nodeObject;
const char* mbElementName = mbString((CciChar*)&elementName,BIP_DEF_COMP_CCSID);
const char* mbElementValue = mbString((CciChar*)&elementValue,BIP_DEF_COMP_CCSID);
const char* traceTextFormat = "Switch Element: name=%s, value=%s";
char* traceText = (char*)malloc(strlen(traceTextFormat) +
strlen(mbElementName) +
strlen(mbElementValue));
sprintf(traceText,traceTextFormat,mbElementName,mbElementValue);
cciUserDebugTrace(&rc,
(CciObject*)thisNode,
myMessageSource,
2,
traceText,
mbElementName,
mbElementValue,
(char*)0);
free((void*)mbElementName);
free((void*)mbElementValue);
free((void*)traceText);