Logging
You are looking at an older version of the documentation. The latest version is found here.
The two procedures described in this page are useful for logging.
SYSADMIN.logMsg
This procedure logs a message to the underlying logging system.
SYSADMIN.logMsg(OUT logged boolean NOT NULL RESULT, IN level string NOT NULL DEFAULT 'DEBUG', IN context string NOT NULL DEFAULT 'org.teiid.PROCESSOR', IN msg object NOT NULL)
If the message has been logged, it returns TRUE
. The level can be one of the Log4j levels: OFF
, FATAL
, ERROR
, WARN
, INFO
, DEBUG
, TRACE
. The level defaults to DEBUG
and the context defaults to org.teiid.PROCESSOR
.
Example
CALL SYSADMIN.logMsg(msg => 'some debug', context => 'org.something')
This will log the message 'some debug' at the default level DEBUG
to the context org.something
.
SYSADMIN.isLoggable
This procedure checks if logging is enabled at the given level and context.
SYSADMIN.isLoggable(OUT loggable boolean NOT NULL RESULT, IN level string NOT NULL DEFAULT 'DEBUG', IN context string NOT NULL DEFAULT 'org.teiid.PROCESSOR')
If logging is enabled, it returns TRUE
. The level can be one of the Log4j levels: OFF
, FATAL
, ERROR
, WARN
, INFO
, DEBUG
, TRACE
. The level defaults to DEBUG
and the context defaults to org.teiid.PROCESSOR
.
Example
BEGIN
IF ((SELECT loggable FROM SYSADMIN.isLoggable(context => 'org.something')))
BEGIN
CALL SYSADMIN.logMsg(msg => 'This message is going to be logged', context => 'org.something');
END
END