
Two principal types of trace messages can be distinguished:
Program flow trace messages
They give information about which part of the program is executed and what control action is needed. If the program flow leaves one component and enters another one, trace messages must be issued to help support engineers.
Messages of this type must use the severity level PATH. The SAP Logging API provides methods like entering() , exiting() , throwing() and catching() .
Program context trace messages
"Program context" can be:
Information about the semantically execution step and its results.
Messages of this type must use the severity level INFO.
Status of important variables. This has to be used with care to avoid replacing debugging. These are mostly variables holding a status description.
Messages of this type must use the severity level DEBUG.
Important return codes of calls. For example, access to external resources, resource bundles, processing servers and libraries. Severity level can be DEBUG or INFO.
Results of condition checks. If there are critical conditions that need to be satisfied in specific places of the code, a trace message must be issued. The severity level must be ERROR.
SAP Logging API provides the method assertion() .
Technical information about terminating of the application. As part of the error handling, an exception is created. A notification on this event has to be written as a log entry. If you need to write additional technical context information, it must be written as a trace with severity ERROR immediately before the throw statement (or inside a " catch " block).
Depending on the type of trace message, the following information must be provided:
Program flow trace messages
The name of the current execution unit and the type of activity must be provided. In case of abnormal leaves or entrances of an execution unit, details to the situation need to be provided.
Program context trace messages
In general, the information provided in these messages must help to quickly and briefly understand the program context. This can be the name and value of important variables.
If a variable holds a complex object, we recommend that you do not insert a complete description of the object, since this will flood the trace file with useless information.
A better idea is to include a brief description of the object, for example the object ID or name and selection of most important attributes.
A detailed examination has to be performed via debugging.