LOG statement

The LOG statement writes a record to the event or user trace logs.

SYNTAX

CATALOG
CATALOG is an optional clause; if you omit it, it defaults to the WebSphere Message Broker current version catalog. To use the current WebSphere Message Broker version message catalog explicitly, use BIPV600 on all operating systems.
EVENT
A record is written to the event log (and also to user trace if user tracing is enabled).
EXCEPTION
The current exception (if any) is logged.
FULL
The complete nested exception report is logged (just as if the exception had reached the input node). If FULL is not specified, any wrapping exceptions are ignored and only the original exception is logged. Thus you can have a full report or simply the actual error report without the extra information concerning what was going on at the time. Note that a current exception only exists within handler blocks (see Handling errors in message flows).
MESSAGE
The number of the message to be used. If specified, the MESSAGE clause can contain any expression that returns a non-NULL, integer, value.

If you omit MESSAGE, its value defaults to the first message number (2951) in a block of messages provided for use by the LOG and THROW statements in the WebSphere Business Integration Message Broker catalog. If you enter a message number, you can use message numbers 2951 to 2999. Alternatively, you can generate your own catalog.

SEVERITY
The severity associated with the message. If specified, the SEVERITY clause can contain any expression that returns a non-NULL, integer, value. If you omit the clause, its value defaults to 1.
USER TRACE
A record is written to the user trace, whether user trace is enabled or not.
VALUES
Use the optional VALUES clause to provide values for the data inserts in your message. You can insert any number of pieces of information, but the messages supplied (2951 - 2999) cater for ten inserts only.

Note the general similarity of the LOG statement to the THROW statement.

  -- Write a message to the event log specifying the severity, catalogue and message
  -- number. Four inserts are provided
  LOG EVENT SEVERITY 1 CATALOG 'BIPv600' MESSAGE 2951 VALUES(1,2,3,4);

  -- Write to the trace log whenever a divide by zero occurs
  BEGIN
    DECLARE a INT 42;
    DECLARE b INT 0;
    DECLARE r INT;

    BEGIN
      DECLARE EXIT HANDLER FOR SQLSTATE LIKE 'S22012' BEGIN
        LOG USER TRACE EXCEPTION VALUES(SQLSTATE, 'DivideByZero');

        SET r = 0x7FFFFFFFFFFFFFFFF;
      END;

      SET r = a / b;
    END;

    SET OutputRoot.XML.Data.Result = r;
  END;
Related concepts
ESQL overview
Related tasks
Developing ESQL
Related reference
Syntax diagrams: available types
ESQL statements
RETURN statement
Example message