mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
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.
22 lines
550 B
Python
22 lines
550 B
Python
#!/usr/bin/env python3
|
|
"""Start litellm proxy with config file."""
|
|
import sys
|
|
import os
|
|
|
|
# Add current directory to path
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
if __name__ == "__main__":
|
|
from litellm.proxy.proxy_cli import run_server
|
|
|
|
# Run the server
|
|
# Disable loop type to use default asyncio (avoid uvloop dependency)
|
|
os.environ["LITELLM_PROXY_LOOP_TYPE"] = "none"
|
|
|
|
sys.argv = [
|
|
"litellm",
|
|
"--config", "reproduce_json_logs_config.yaml",
|
|
"--port", "4000"
|
|
]
|
|
|
|
run_server()
|