[RFE] Ability to append output to log file

Status Fixed / completed
Maintainer reply None cached
Activity 7 comments · opened Aug 13, 2025 · closed Aug 18, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.77 (Claude Code)
  • Operating System: Windows 11
  • Terminal: WSL2 bash

Description

I want to let Claude Code run background tasks but I often find myself missing out on activity that scroll past the terminal buffer.

What I tried

  • wsl.exe -d Ubuntu bash -lc "script -a claude.log -c claude" retains an interactive console and logs to a file with colors
  • wsl.exe -d Ubuntu bash -lc "fifo=\$(mktemp -u); mkfifo \"\$fifo\"; sed -r 's/\x1B\[[0-9;?]*[ -/]*[@-~]//g' < \"\$fifo\" >> claude.log & spid=\$!; script -qf \"\$fifo\" -c 'claude'; wait \$spid; rm -f \"\$fifo\"" retains an interactive console and strips colors out before logging to a file

Both approach work, but unfortunately the animation gets logged which means that log file output is extremely verbose to a point of being useless.

Please provide a built-in feature for append the output to a file (with and without colors getting stripped out) in a way that does not log the animation but rather only the final result.

View original on GitHub ↗

7 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4483
  2. https://github.com/anthropics/claude-code/issues/805
  3. https://github.com/anthropics/claude-code/issues/4329

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

cowwoc · 1 year ago

This feature request is different. I'm asking for realtime logging as Claude Code is running. I don't want to invoke a command to trigger an export to a log file every time.

cowwoc · 1 year ago

I build this Python script which seems to do what I want. You can invoke it like this: wsl.exe -d Ubuntu bash -lc "python3 claude.py --log claude.log -- claude --dangerously-skip-permissions"

claude.zip

cowwoc · 1 year ago

I've been unable to make this work without the screen "stuttering". It seems that when PTY is used, Claude redraws the entire console every time a line is added. Unfortunately, it doesn't look like this is fixable outside of Claude's codebase...

cowwoc · 1 year ago

I've noticed that there are multiple complaints of the TUI redrawing the entire screen over and over again:

https://github.com/anthropics/claude-code/issues/1854
https://github.com/anthropics/claude-code/issues/769

and probably others. Fixing this issue would have an indirect effect of solving this issue as well as it would enable us to log Claude's output using external tools.

cowwoc · 1 year ago

I'm going to close this issue in favor of https://github.com/daaain/claude-code-log

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.