Tracing exceptions
Exception can be logged in a file when using the STARTLOG()
function.
Exceptions are automatically logged in a file, if all the following conditions are true:
- The STARTLOG function has been previously called to specify the name of the exception logging file.
- The exception action is set to
CALL,GOTOorSTOP. Exceptions are not logged when the action isCONTINUEorRAISE. - The exception class is an
ERROR,ANY ERRORorWARNING.NOT FOUNDexceptions cannot be logged.
In other words, errors will not be logged in the case of WHENEVER , or when controlled by a
{ [ANY]
ERROR | WARNING } CONTINUETRY/CATCH block.
Each log entry contains:
- The system-time
- The location of the related instruction (source-file, line)
- The error-number
- The text of the error message, giving human-readable details for the exception
It is good practice to generate the call stack trace with the base.Application.getStackTrace() function,
typically in the handler used WHENEVER ERROR CALL my_handler().