sf-debugging-logs

Diagnose Salesforce failures using debug logs, trace flags, and the Tooling API.

2|Updated Sep 12, 2026
One-click install
npx skills add https://github.com/grzmol/vibe-force --skill sf-debugging-logs-grzmol
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sf-debugging-logs
Source: https://github.com/grzmol/vibe-force/tree/main/skills/sf-debugging-logs
Command: npx skills add https://github.com/grzmol/vibe-force --skill sf-debugging-logs-grzmol

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? When an Apex test, trigger, batch job, Flow, or callout fails in a Salesforce org, the raw error message rarely explains why. This Skill provides a systematic method for capturing and reading Salesforce debug logs so you can pinpoint the exact code unit, query, limit, or exception behind a failure. ## Core Features & Use Cases - Trace Flag Management: Create and delete TraceFlag and DebugLevel records via the Tooling API or sf CLI, with correct scoping to avoid the 20 MB log and 1000 MB rate limits. - Log Retrieval and Analysis: Use sf apex list log, get log, and tail log, then read execution units, SOQL_EXECUTE, DML, LIMIT_USAGE_FOR_NS, CUMULATIVE_PROFILING, and FLOW_* events in the right order. - Symptom-Driven Playbooks: Diagnose CPU time and heap limit errors, silent batch and queueable failures, callout errors, Flow interference, and missing System.debug output using grep-based recipes. - Use Case: A batch job reports failure with no stack trace. Query AsyncApexJob for the failed chunks, fetch the per-chunk logs, grep for FATAL_ERROR, and identify the exact line and limit that caused the rollback. ## Quick Start Ask the assistant to capture and analyze a debug log for the failing Apex test or transaction in your target Salesforce org.

Frequently Asked Questions about sf-debugging-logs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get a debug log in Salesforce from the CLI?

Use sf apex tail log to stream logs live, or sf apex list log followed by sf apex get log --log-id to fetch a specific log. The tail command auto-creates a trace flag unless you pass --skip-trace-flag.

How do I set a trace flag for a Salesforce user?

Create a DebugLevel record, then create a TraceFlag via sf data create record --use-tooling-api with LogType=USER_DEBUG, the user's Id as TracedEntityId, and an ExpirationDate less than 24 hours after StartDate.

Why is my System.debug output missing from the log?

Common causes are APEX_CODE set below DEBUG, a truncated 20 MB log dropping older lines, no active trace flag, or trace flags auto-disabled after exceeding the 1000 MB generation window. Check the log header and ApexLog.LogLength first.

How do I debug a failed Salesforce batch job?

Query AsyncApexJob for Status, NumberOfErrors, and ExtendedStatus, which holds only the first error. Each batch chunk is a separate transaction with its own log, so fetch multiple logs and grep each for FATAL_ERROR.

What are the Salesforce debug log size limits?

A single log is capped at 20 MB with older lines removed from anywhere, logs generate at most 1000 MB per 15-minute window before trace flags are auto-disabled, and org accumulation of 1000 MB blocks new trace flags until logs are deleted.

Can I debug Apex without adding System.debug statements?

Yes. Use the Apex Replay Debugger with checkpoints and heap dumps in VS Code, which captures variable state at specific lines without modifying code. This avoids the CPU cost and PII exposure of debug statements.