Use the LOG statement to write a record to the event log or to the user trace.
>>-LOG--+-EVENT-------+--+---------------------+--+---------+--+------------------------------+->< '-USER--TRACE-' '-+------+--EXCEPTION-' '-Options-' | .-,----------. | '-FULL-' | V | | '-VALUES--(----Expression-+--)-' WHERE |--Options =--+----------------------+--+---------------------+--+---------------------+--| '-SEVERITY--Expression-' '-CATALOG--Expression-' '-MESSAGE--Expression-'
For more information on exceptions, see Errors and exception handling.
If you omit MESSAGE, its value defaults to the first message number (2951) in a block of messages that is provided for use by the LOG and THROW statements in the IBM Integration Bus catalog. If you specify a message number, you can use message numbers 2951 through 2999. Alternatively, you can generate your own catalog.
Note the general similarity of the LOG statement to the THROW statement.
-- Write a message to the event log specifying the severity, catalog and message
-- number. Four inserts are provided
LOG EVENT SEVERITY 1 CATALOG 'BIPmsgs' 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.XMLNS.Data.Result = r;
END;