Write system log entries from custom ABAP

For some specific requirements (like system monitoring) you might need to write entries into the ABAP system log (transaction SM21).

Preparation

In SE92 (see this blog) create a new message for the system log. It is best to create your own Z message code in stead of re-using standard SAP.

Writing to system log

OSS note 5462 – Writing SysLog entries from within ABAP/4 programs explains 2 methods, for which using function module RSLG_WRITE_SYSLOG_ENTRY is the preferred one.

Program RSLG0014 can be used to test the writing and basis for code re-use:

System log messages and audit log messages

System and audit log message are used in many different ways and applications.

When you have a system log message code or audit log message code, you might want more information, or in some cases change the severity level of the code.

Questions that will be answered in this blog are:

  • Where can I find the definition of the system log message codes and their long text?
  • Where can I find the definition of the audit log message codes and their long text?
  • How can I change the severity of system log and audit log messages?

Maintenance of system log and audit log messages

Maintenance of system and audit log messages is done with transaction SE92:

You can now get a list of messages:

And per message you can see the details:

In the details you can see the short text, long text and the Severity. The severity will determine the traffic light in the SM21 system log overview.

For ABAP code to write the new message to the system log, read this blog.

Audit log change of severity

You can also change audit log severity:

Changing from default SAP does require a key.

Related OSS notes

OSS notes: