How to output Salesforce session Id in Apex debug log?

UserInfo.getSessionId() is one of those methods you reach for constantly, mainly when you’re making REST callouts from Apex. The annoyance: you can’t actually see it in your debug logs. Try the obvious approach: Output: Try being clever about it: Same result. Salesforce scrubs session IDs out of logs regardless of how you wrap them. Intentional, […]