Create a logger - SchwarzIT/sap-usi-logging-api GitHub Wiki
The following call will return a log writer instance.
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 either creates a new log writer instance or returns an existing logger. The behavior depends on the customizing: Customizing -> Sub log behavior
If a new logger is created and another logger already exists, the old logger will become the parent of the new one. The settings of the child logger will be partly inherited from the parent logger in that case.
| Setting | Behavior |
|---|---|
| Auto save package size | Taken from parent, if:
|
| Log Level | Highest log level (parent/child) wins. |
| Retention time in days | Highest value (parent/child) wins. |
| No early deletion | True, if parent or child do not allow an early deletion. |
When a child logger is created, trace messages will be added to both loggers and their data containers will provide a navigation between the two 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.