diff --git a/litellm/__init__.py b/litellm/__init__.py index 98c9dcb5ddf..f59ef829aa9 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -40,6 +40,8 @@ from litellm._logging import ( verbose_logger, json_logs, _turn_on_json, + ecs_logs, + _turn_on_ecs, log_level, ) import re diff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.py index c0246f234a8..85e62ea75f5 100644 --- a/litellm/proxy/proxy_cli.py +++ b/litellm/proxy/proxy_cli.py @@ -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 diff --git a/litellm/sitecustomize.py b/litellm/sitecustomize.py index 90dcd62614a..0717565cc1f 100644 --- a/litellm/sitecustomize.py +++ b/litellm/sitecustomize.py @@ -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: