Salesforce Decode
Salesforcedecode
Back to questions
ApexIntermediateloggingobservabilitysupport

Design Apex logging framework for production support

Real World Scenario

Production issues require reproducing user actions but debug logs unavailable and System.debug stripped.

Expected Answer

• Custom Log__c object with level, correlation Id, user, payload hash • Logging service gated by custom setting log level per user • Async log insert to avoid DML limit impact on business transaction • Platform Event for high-volume log streaming to external SIEM optional • PII scrubbing before persist • Retention job purging logs older than 90 days • Support tooling query by correlation Id from user-facing error reference

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Direct answer: Custom Log__c object with level, correlation Id, user, payload hash Also consider: Logging service gated by custom setting log level per user In practice: Async log insert to avoid DML limit impact on business transaction Balance speed of delivery with maintainability.

Architect Perspective

Production logging is feature—invest early with PII discipline.