Enable Debug Logs for a User
sf_enable_debug_logsTurn on Apex debug logging for a Salesforce user by creating a DebugLevel and TraceFlag, so new logs can be captured and retrieved.
Instructions
Turns on Apex debug logging for a user by creating a DebugLevel and TraceFlag via the Tooling API. Required before sf_get_debug_logs will return anything new — Salesforce does not log activity unless a trace flag is active for that user.
username: username of the user to trace, e.g. 'ajay@example.com' durationMinutes: how long tracing stays active (default 30, max 1440) debugLevel: Apex code log granularity — FINEST (most verbose, recommended for debugging) down to ERROR
After enabling, have the user (or an automated process) perform the action you want to debug, then call sf_get_debug_logs to list the resulting logs and sf_get_debug_log_body to read one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | Username of the user to trace, e.g. 'ajay@example.com' | |
| debugLevel | No | Apex code log granularity for the debug level (applies to ApexCode category; other categories default to a matching verbosity) | FINEST |
| durationMinutes | No | How long the trace flag stays active, in minutes (max 24 hours) |