Cert++
Close

Service communication logging and masking sensitive data

Key Takeaway

On a production instance, communication data is logged only when "Communication Log Enabled" is checked and the service implements filterLogMessage or both getRequestLogMessage and getResponseLogMessage.

The B2C Commerce web service framework can write log entries for every outgoing service call. One of these logs is the communication log, which holds the actual request and response data. That data can contain secrets such as credit card numbers, passwords, or auth tokens. For that reason, the framework gives developers callbacks to filter or rebuild log messages. On production, the framework blocks unfiltered communication logs.

Three types of service log messages

Each service call can write three types of log messages to a custom log category named service.serviceName.type. The last segment of the category name is the log type.

Log typeWhat it logs
headSuccess or failure, after every call
commThe data passed to the underlying transport, and the response received from it
logMiscellaneous messages, such as service initialization and error traces

The comm messages make up the communication log.

The period-delimited segments of a service name become part of the logging hierarchy. A service name that follows the pattern {cartridge}.{protocol}.{service}.{operation}, such as mycartridge.http.payment.get, groups logging for related services. The pattern also keeps service names unique.

Your cartridge acme calls a shipping provider over HTTP through two services named acme.http.shipping.rates and acme.http.shipping.labels. The rates service writes its comm messages to the category service.acme.http.shipping.rates.comm and its head messages to service.acme.http.shipping.rates.head. Both service names share the segments acme.http.shipping, so the logging for both services sits under service.acme.http.shipping in the hierarchy.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers. 796 members and growing.