Create a logger - SchwarzIT/sap-usi-logging-api GitHub Wiki
The first step is to call the central factory in order to create the logger.
DATA(logger) = /usi/cl_bal_factory=>get_instance( )->create_new_logger( i_log_object = 'ZMY_REPORT'
i_sub_object = 'DELETE_USER'
i_external_id = i_username ).| Name | Mandatory? | Description |
|---|---|---|
| i_log_object | yes | Log object |
| i_sub_object | Depends on i_log_object |
Subobject |
| i_external_id | no | Should be used whenever possible to make searching for logs easier. Should be the technical ID of the processed object. |
Log object and sub object are defined in transaction SLG0.
Log objects may or may not have subobjects - this is up to the person customizing them. But there is a catch, one needs to know: If a log object has subobjects, using them becomes MANDATORY!
The method creates a new log writer instance.
If previously created log writer instances are still active, the latest instance becomes the parent of the new logger. Trace messages will be added to both loggers and their data containers will provide the navigation to the parent and child logs (see: Central Concepts -> One Log).
Passing an invalid combination of log object and subobject will make the factory use a valid fallback instead. The logger will still be created but with a different combination of log object and subobject. If you cannot find your log check the troubleshooting guide (see: (Troubleshooting -> Log cannot be found).
You might also want to check the log levels for both: the passed combination and the fallback.