-
Notifications
You must be signed in to change notification settings - Fork 2
HelloWorld
Andres Gomez Casanova edited this page Jun 3, 2022
·
2 revisions
This page explains a fast start with log4db2
This could be the structure of your code.
CREATE OR REPLACE PROCEDURE HELLO_WORLD ()
BEGIN
DECLARE LOGGER_ID SMALLINT;
--Your declarations here.
LOGGER.GET_LOGGER('Your.Hierarchy', LOGGER_ID);
-- Your code here.
LOGGER.INFO(LOGGER_ID, 'Your message');
-- More of your code.
END@
CREATE OR REPLACE FUNCTION HELLO_WORLD ()
RETURNS INTEGER
BEGIN
DECLARE LOGGER_ID SMALLINT;
--Your declarations here.
LOGGER.GET_LOGGER('Your.Hierarchy', LOGGER_ID);
-- Your code here.
LOGGER.INFO(LOGGER_ID, 'Your message');
-- More of your code.
RETURN 0;
END@
You invoke your code (if it is a stored procedure or a function.)
CALL HELLO_WORLD();
VALUES HELLO_WORLD();
This is the easiest way to check the log messages.
CALL LOGADMIN.LOGS();
db2 "CALL LOGADMIN.LOGS()"
Check the Usage section for more information about the levels, and how to access the messages and configure the utility.
For more advice about how to use log4db2 please visit the Tips section.