Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 5 of 7

Logging without leaking personal data

8 min

Listen to this lesson

0:00 / 8:06

When an order fails at 02:00, the person on call has the message processing log (MPL) and whatever your flow put into it. Good logging answers three questions fast: which business document, which step, and why. Bad logging either answers none of them or answers them by dumping the full payload, names, addresses and all, into a log that many people can read. This lesson is about getting the first without the second.

Log levels

You set the log level per deployed integration flow in the Monitor, under Manage Integration Content, in the Log Configuration section. A newly deployed flow runs at Info. Changes apply only to messages created after the change.

Log levelWhat is recordedExpiry and cautions
NoneNothing; no data in monitoringMessages become invisible, including to SAP Cloud ALM
InfoBasic information; for failed messages, details of the last 50 stepsThe default
ErrorFailed messages only, last 50 steps; no MPL attachmentsA final successful retry is not recorded, so the status can stay Retry or Failed
DebugAll steps with headers and details; no payloadExpires and switches back; fixed at 24 hours in the Cloud Foundry environment
TraceAll steps plus message content: payload, headers, propertiesExpires after 10 minutes by default; content retained 1 hour by default

Log levels per SAP Help, Setting Log Levels.

Two traps follow from the table. Error looks like a sensible production setting until you combine it with JMS retries: the message that succeeded on the fourth attempt still shows Retry or Failed, and someone reprocesses an order that already posted. And None hides messages from central monitoring: SAP Cloud ALM only collects messages that have an MPL. Contoso keeps Info in production and switches to Trace only in CMC_TEST, or in production for a short, approved diagnosis, because Trace stores the payload. The header SAP_MessageProcessingLogLevel (INFO, NONE, DEBUG or ERROR) can set the level for a single incoming message.

Trace is deliberately short-lived: about 10 minutes to capture, about an hour to read the content (SAP defaults).
The Sign-Off Table · thesignofftable.com/academy/sap-pim-207

Make messages searchable with headers, not payloads

Cloud Integration reads a few headers into the MPL so you can search without opening payloads. Set them early, in the first Content Modifier:

Header or propertyShown in monitoring asContoso value
SAP_ApplicationID (header)Application Message ID (first 120 characters displayed)The Great Lakes PO number, e.g. GLFS-4471
SAP_MessageType (header)Application message type (first 100 characters)GLFS_SALES_ORDER
SAP_Sender / SAP_Receiver (headers)Sender and ReceiverGLFS / CMP
SAP_MessageProcessingLogCustomStatus (property)Custom Status (max 40 alphanumeric characters)Parked, Duplicate

Standard headers that turn a message ID into a business search.

For anything else, a Groovy script can call messageLogFactory.getMessageLog(message) and then addCustomHeaderProperty(name, value). Custom header properties are persisted and searchable; Contoso adds the plant (1710) and the sold-to party. By contrast, properties written with setStringProperty appear in the MPL only at Debug or Trace.

Attachments and the data protection risk

addAttachmentAsString(name, text, mediaType) attaches text to the MPL, and SAP's own examples attach the incoming payload. Be careful. SAP Help warns that payload attachments consume the tenant's limited storage and, at high volume, can push the tenant until the circuit breaker opens. The bigger issue is personal data: a Great Lakes order carries a ship-to contact name, phone number and delivery address. MPL data is kept for 30 days by default and is readable by everyone with monitoring access. The HTTP receiver's Attach Error Details on Failure option does the same with response bodies.

Instead of…Log thisWhy
The full order payloadPO number, item count, failed step, error textEnough to find and fix; no personal data
Every message, alwaysAttachments only in the exception subprocessSuccesses need no evidence in the log
A permanent payload dumpPayload only when SAP_MPL_LogLevel_Overall is TraceSAP's own pattern for attachments that respect the log level
Contact names in custom headersBusiness keys: PO number, plant, sold-to numberSearchable fields should not be personal data
Contoso's logging rules, agreed with Nadia (security and GRC).
The Sign-Off Table · thesignofftable.com/academy/sap-pim-207

SAP's Setting Log Levels page shows a script that reads the property SAP_MPL_LogLevel_Overall and adds the payload attachment only when it is high enough. Contoso uses that pattern in CMC_Common_ErrorHandler, and Nadia reviews every flow that writes an attachment. If you must keep a failed payload, keep it where access is controlled and expiry is defined (a parking queue or an encrypted data store), not in the log.

Trace in production deserves a rule of its own, because it captures the very payloads you kept out of the log. At Contoso, switching a production flow to Trace needs a ticket that names the reason and the time window, Nadia's approval when the flow carries personal data, and a note when the level has switched back. Most diagnoses do not need it: the business key, the failed step and the error text in an Info log usually locate the problem, and the payload can be reproduced in CMC_TEST.

Key points
  • Log levels: None, Info (default), Error, Debug and Trace; Debug and Trace expire.
  • Error hides successful final retries; None hides messages from SAP Cloud ALM.
  • Search by business key with SAP_ApplicationID, SAP_MessageType, SAP_Sender, SAP_Receiver and custom headers.
  • Payload attachments cost storage and can expose personal data for 30 days; attach only on error, without personal data.

Check your understanding · not graded

Lesson check

  1. 1. Which log level records message content (payload, headers, properties) at each step?

  2. 2. A flow with JMS retries runs at log level Error. What can mislead the support team?

  3. 3. Which header makes the Great Lakes PO number appear as Application Message ID?

  4. 4. Why should a flow avoid attaching the full order payload to every MPL?