Commit graph

1 commit

Author SHA1 Message Date
Claude
ee419b09ea
Add real proxy server reproducer for json_logs issue
Successfully reproduced the issue with actual running proxy server!

Key findings:
- ERROR logs with exceptions ARE properly formatted as JSON ✅
- Startup INFO logs are NOT formatted as JSON ❌
- ANSI color codes appear in logs ([94m, [32m, etc.) ❌
- Mix of JSON and plain text logs confirmed

Issue reproduced:
1. Started litellm proxy with json_logs: true
2. Made requests to trigger various errors
3. Captured actual logs showing the problem

Problem logs (plain text with ANSI codes):
- "Using json logs. Setting log_config to None."
- "[94m Initialized Success Callbacks - [] [0m"
- "[32mLiteLLM: Proxy initialized with Config, Set models:[0m"

Working logs (proper JSON):
- {"message": "litellm.proxy.proxy_server._handle_llm_api_exception()...", "level": "ERROR", ...}
- {"message": "Failed to load vertex credentials...", "level": "ERROR", "stacktrace": "..."}

Root cause:
- Some code uses print() statements instead of loggers
- Colored formatters bypass JsonFormatter
- ANSI escape codes in formatter not removed when json_logs enabled

Files added:
- reproduce_json_logs_config.yaml: Proxy config with json_logs enabled
- start_proxy.py: Script to start proxy programmatically
- reproduce_json_logs.sh: Automated test that runs proxy and analyzes logs
- actual_proxy_logs.txt: Real captured logs showing the issue
- REPRODUCER_RESULTS.md: Comprehensive analysis and findings

This exactly reproduces dmc's reported issue from the Slack thread.
2026-01-19 22:53:15 +00:00