OmniscioGuidesClaude Code debug logs
Claude Code debug logs: turning them on, filtering them, finding them
The terminal shows what Claude is doing. The parts that go wrong quietly are written to a log instead, and that log usually has to be switched on before the problem happens or the detail is not captured.
The config debugging guide covers why a settings file or a CLAUDE.md is not taking effect, and the environment variables guide covers where these variables are read from. This page owns the log itself: how to start it, how to narrow it, and where the file lands.
Sources read November 25, 2026. By the Omniscio team. Updated .
Ways to turn it on
Start the session with the flag:
claude --debugOr set DEBUG=1 in the environment before launching, which Anthropic documents as equivalent to --debug. With debug mode on, the log is written to ~/.claude/debug/<session-id>.txt.
DEBUG=1 claudeOr, in a session that is already running, run /debug, optionally with a description of what is wrong. Debug logging is off by default unless you started with claude --debug, so running /debug mid-session starts capturing logs from that point forward: the earlier turns are not in the file.
/debug the MCP server connects but lists no toolsThe command also turns the log into an answer: it reads the session debug log and diagnoses the issue, so it is the shortest route when you know the symptom but not the subsystem.
Filtering by category
--debug takes an optional category filter, such as --debug='mcp,startup' to keep those categories, or --debug='!mcp' to drop one.
claude --debug='mcp,startup'One detail costs people a debugging session of its own: the filter binds only in the equals form. A space-separated filter, as in claude --debug mcp, enables debug mode without filtering anything, so the log fills with every category and the file is far larger than expected.
Where the log is written
By default, the log for a session is ~/.claude/debug/<session-id>.txt: one file per session, named for that session id.
On Windows, that path starts at %USERPROFILE%\.claude\debug\, because ~/.claude resolves to %USERPROFILE%\.claude there.
Sending it somewhere else
--debug-file <path>writes the log to that exact path. It implicitly enables debug mode and takes precedence over the variable below.CLAUDE_CODE_DEBUG_LOGS_DIRoverrides the log path. Despite the name, Anthropic documents it as a file path, not a directory, and it needs debug mode enabled separately through--debug,/debugorDEBUG.
How much detail
CLAUDE_CODE_DEBUG_LOG_LEVEL sets the minimum level written to the file. The values are verbose, debug (the default), info, warn and error. verbose is the one that includes the high-volume diagnostics, such as the full output of a status line command.
What people read it for
The debug log is where answers to the quiet failures live. Four examples from Anthropic’s own pages:
- An MCP server that shows as connected but lists zero tools: reconnect it from
/mcpfirst; if the count stays at zero, runclaude --debug=mcpand read the server’s stderr in the debug log. The MCP errors guide covers the rest of that failure. - A tool left out because its name is longer than 128 characters: the log names the tool and gives its length against the limit.
- Spell checking that behaves oddly writes
[spellcheck]lines naming the program Claude Code started, or the ones it looked for and did not find. - A restore that skipped files: the message gives only a count, and the log names each skipped path.
--verbose is a different flag
--verbose enables verbose logging and shows full turn-by-turn output. For that session it overrides the viewMode setting, which otherwise decides whether a session starts in the default, verbose or focus view. It does not replace --debug: one changes what the session shows, the other writes a file you can read afterwards.
Use --verbose when you want to watch a turn as it happens. Use --debug when you want a file you can read afterwards, or hand to someone else.
Sources
Every line on this page rests on one of these. The date beside each one is the day we read it.
- CLI reference, for
--debug, its category filter syntax and--debug-file, and for--verboseand theviewModeoverride. Read November 25, 2026. - Environment variables, for
DEBUG,CLAUDE_CODE_DEBUG_LOGS_DIRandCLAUDE_CODE_DEBUG_LOG_LEVEL. Read November 25, 2026. - Commands, for the
/debugentry and its capture-from-now behaviour. Read November 25, 2026. - Debug your configuration, for the MCP server that lists zero tools and the
~/.claude/debug/<session-id>.txtpath. Read November 25, 2026. - Interactive mode, for the
[spellcheck]lines. Read November 25, 2026. - Errors, for the skipped-file count that names the files only in the debug log. Read November 25, 2026.
- Settings reference, for
viewModeand the default, verbose and focus views. Read November 25, 2026. - Explore the .claude directory, for
~/.clauderesolving to%USERPROFILE%\.claudeon Windows. Read November 25, 2026.
No debug log was produced for this page. Every flag, variable, path and level is transcribed from those pages.
Common questions
How do I turn on debug logging in Claude Code?
Start the session with claude --debug, set DEBUG=1 in the environment, or run /debug inside a session. Debug logging is off by default, so running /debug mid-session starts capturing from that point forward.
Where is the Claude Code debug log?
Each session writes to ~/.claude/debug/<session-id>.txt, unless you set the path with --debug-file or the CLAUDE_CODE_DEBUG_LOGS_DIR variable.
How do I filter the debug log to one category?
Use the equals form, for example claude --debug='mcp,startup' to keep those categories or claude --debug='!mcp' to drop one. The filter binds only in the equals form; a space-separated filter turns debug mode on without filtering anything.
Is --verbose the same as --debug?
No. --debug writes a log file for diagnosis. --verbose enables verbose logging and shows full turn-by-turn output, overriding the viewMode setting for that session.
Why does CLAUDE_CODE_DEBUG_LOGS_DIR point at a file?
Despite the name, Anthropic documents it as a file path rather than a directory, and it needs debug mode enabled separately through --debug, /debug or the DEBUG environment variable.
Every session, one window
Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness: Claude Code, Codex, OpenCode, Devin, Pi, and Hermes all supported.