Skip to main content
Logging is essential for understanding typemux-cc’s behavior, diagnosing issues, and monitoring backend pool activity.

Default Behavior

By default, typemux-cc writes logs to stderr only:
This is suitable for development but not persistent across sessions.

Enabling File Logging

Method 1: Environment Variable (Quick)

Set TYPEMUX_CC_LOG_FILE to enable both stderr and file output:
When TYPEMUX_CC_LOG_FILE is set, logs are written to both stderr AND the file. This allows real-time monitoring while preserving a persistent record.

Method 2: Config File (Persistent)

For persistent logging across Claude Code restarts:
See Config File for more details.

Log Levels

Control log verbosity with the RUST_LOG environment variable:
string
default:"typemux_cc=debug"

Available Levels

Examples

Minimal logging (production):
Default (recommended for development):
Maximum verbosity (troubleshooting):

What Each Level Shows

info - High-Level Events

debug - Default Level

Includes everything from info plus:

trace - Deep Debugging

Includes everything from debug plus:
trace level produces very large log files. Use only when debugging specific issues, then switch back to debug.

Real-Time Monitoring

Monitor logs in real-time using tail:
Open a separate terminal for real-time monitoring while working in Claude Code. This helps understand what’s happening behind the scenes.

Useful Log Queries

Grep patterns for common debugging scenarios:

Monitor Backend Pool Activity

Example output:

Track Warmup Transitions

What to look for:
  • Warming -> Ready indicates successful index build
  • Long warmup times may indicate large codebases
  • Queued request counts show how many requests waited

View Document Restoration

Example output:
This shows how many open documents were sent to a newly spawned backend.

Find Session Transitions

Useful for understanding backend lifecycle and request routing.

Debug .venv Detection Issues

Common issues:
  • venv_path=None in logs → file opened before .venv was created
  • No search logs → document using cached venv from previous open

Filter by Time Range (with timestamps)

If your logs include timestamps, filter by time:

Log Rotation

typemux-cc uses Rotation::NEVER - logs are appended to the same file indefinitely.
For long-running sessions, you may want to rotate logs manually:
Truncating the log file while typemux-cc is running may cause issues. Restart Claude Code after truncating.

Interpreting Common Log Messages

Backend Spawn Events

Meaning: A new backend process started for the detected .venv.

Warmup State

Meaning: Backend finished building its index. 3 queued requests are now being sent.

LRU Eviction

Meaning: Pool was full, least recently used backend evicted to make room.

TTL Eviction

Meaning: Backend was idle for longer than TYPEMUX_CC_BACKEND_TTL (default 30 minutes).
Meaning: Successfully located .venv by traversing parent directories.

Document Restoration

Meaning: After spawning backend for project-b, sent 5 documents under project-b/, skipped 3 from other projects.

Troubleshooting with Logs

Issue: LSP not responding

Check logs for:
Common causes:
  • Backend binary not found in PATH
  • Backend crashed during initialization
  • Permission issues with .venv directory

Issue: Wrong completions/types

Check for:
Look for:
  • venv_path=None → No .venv detected (strict venv mode)
  • Wrong venv path → Document using cached venv from first open
  • Multiple venv paths for same file → Cache invalidation issues
Solution: Reopen the file to trigger fresh venv detection.

Issue: Slow response after file open

Check warmup times:
Large projects may take 5-10 seconds to build their index. Consider:
  • Increasing TYPEMUX_CC_WARMUP_TIMEOUT if timeout expires prematurely
  • Keeping TYPEMUX_CC_BACKEND_TTL high to avoid frequent re-initialization

Log Output Format

Logs include these fields (from main.rs:64-75):
  • Timestamp (implicit)
  • Level: INFO, DEBUG, TRACE, WARN, ERROR
  • Target: Rust module path (e.g., typemux_cc::proxy)
  • Thread ID: For concurrent debugging
  • Message: Human-readable event description
  • Structured fields: venv=, session=, method=, etc.
Example:

Performance Considerations

impact
For production use in Claude Code, keep RUST_LOG=typemux_cc=debug (default). Switch to info only if performance is critical and you don’t need debugging.