ABAP: Logging – Logger

The use of the SAP standard functions for logging is a bit complex. Especially if you are used to log strings. The functions deployed by SAP are:  BAL_LOG_MSG_ADD, BAL_LOG_CREATE, BAL_DB_SAVE, BAL_LOG_REFRESH

As i described in this articel – they all make the use of the character 50 fields MSGV1 to MSGV4 with it flaws. So this little utility class (download txt-logger-class) here makes use of the standard functions – to log things a bit more like in java.

The Logging can be monitored in the transaction SLG1. The Objects are like logging-categories. They can be maintained in SLG0.


*examples
" You can maintain your own objects in transaction SLG0 – create ZTEST

zcl_log=>info( msg = ‚msg msg msg msg 123 123 123 test‘ obj = ‚ZTEST‘).
zcl_log=>alert( msg = ‚msg msg msg msg 123 123 123 test‘ obj = ‚ZTEST‘).
zcl_log=>warning( msg = ‚msg msg msg msg 123 123 123 test‘ obj = ‚ZTEST‘).
zcl_log=>error( msg = ‚msg msg msg msg 123 123 123 test‘ obj = ‚ZTEST‘).

zcl_log=>save( ). "now control the transaction SLG1 with object ZTEST to see the test messages

I recommend to set the class for system wide use.

ABAP: Logging – Logger