feat(logging): integrate ECS logging support in initialization and proxy CLI

This commit is contained in:
Supul 2026-06-07 17:43:46 +05:30
parent e0a08ccf1e
commit 50180f7516
3 changed files with 7 additions and 6 deletions

View file

@ -40,6 +40,8 @@ from litellm._logging import (
verbose_logger,
json_logs,
_turn_on_json,
ecs_logs,
_turn_on_ecs,
log_level,
)
import re

View file

@ -180,8 +180,7 @@ class ProxyInitializationHelpers:
if log_config is not None:
print(f"Using log_config: {log_config}") # noqa
uvicorn_args["log_config"] = log_config
elif litellm.json_logs:
# Use JSON log config for uvicorn to ensure all logs (including exceptions) are JSON
elif litellm.ecs_logs or litellm.json_logs:
uvicorn_args["log_config"] = _get_uvicorn_json_log_config()
if keepalive_timeout is not None:
uvicorn_args["timeout_keep_alive"] = keepalive_timeout

View file

@ -1,9 +1,9 @@
"""
ECS logging early-startup hook for litellm.
ECS logging early-startup hook template for litellm.
Python executes sitecustomize.py from the active site-packages directory
before any user code, making it the right place to configure logging format
before the first log record is emitted.
This file is a deploy-time template. It will NOT auto-execute from its current
location inside the litellm package. Python only auto-runs sitecustomize.py if
it exists as a top-level module in a site-packages directory.
To enable ECS-compliant log output without touching application code: