Using error logging from a user-defined extension

Program user-defined extensions to write entries in the local error log.

About this task

In most circumstances, user-defined extensions should use exceptions to report errors. However, you can provide information about significant events, error or otherwise, for problem determination and operational purposes. The details that you supply are included in predefined message text that is extracted from a message source or catalog.

  • In C code, use the utility function CciLog or CciLogW to report events. Two of the arguments that you pass to this function, messageSource and messageNumber, define the event source (catalog) and the integer representation of a message within that source, respectively.

    You can also write trace information, using CciUserTrace, CciUserTraceW, CciUserDebugTrace, and CciUserDebugTraceW when tracing and debugging is active.

  • In Java™ code, use the class MbService, which provides static methods to log information to the event log. To log messages to the event log, package your messages into a standard Java resource bundle. You can use one of the three logging methods, passing in the resource bundle name and the message key. The message is fully resolved, and is then inserted as a single insert into the appropriate integration node message as shown:
    • logInformation( ... ) - BIP4360 Java user-defined node information: user message
    • logWarning( ... ) - BIP4361 Java user-defined node warning: user message
    • logError( ... ) - BIP4362 Java user-defined node error: user message

You can write messages that are defined in the product message catalog (BIPmsgs), to which you can add your own text as an argument. If you prefer, you can create your own message catalog, so that you can create more complex messages, or share a message catalog with other applications. If you want to create your own message catalog, see Creating message catalogs.

  • Windows platformOn Windows systems, messages are written to the Windows event log.
  • Linux platformUNIX platformz/OS platformOn Linux®, UNIX, and z/OS® systems, messages are written to the SYSLOG facility.

The description here covers exceptions that are raised during normal message flow processing. You must also provide for exceptions that are raised when you deploy and configure a message flow. Messages that result from these configuration exceptions are reported back to the IBM® Integration Toolkit for display to the IBM Integration Toolkit user. Create an appropriately-named Java properties file to contain your messages, then copy the file to each computer on which you are running the IBM Integration Toolkit, so that your messages can be displayed.