From e8cbcb36005a32c7ff04d9b5ace618001dc3bda3 Mon Sep 17 00:00:00 2001 From: Shahar Glazner Date: Sat, 18 Jan 2025 15:53:43 +0200 Subject: [PATCH] feat(api): uvicorn (#3050) --- keep/api/logging.py | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/keep/api/logging.py b/keep/api/logging.py index 58d414d1c..96b4b28a8 100644 --- a/keep/api/logging.py +++ b/keep/api/logging.py @@ -379,3 +379,12 @@ def setup_logging(): logging.config.dictConfig(CONFIG) uvicorn_error_logger = logging.getLogger("uvicorn.error") uvicorn_error_logger.__class__ = CustomizedUvicornLogger + + # ADJUST UVICORN ACCESS LOGGER + # https://github.com/benoitc/gunicorn/issues/2299 + # https://github.com/benoitc/gunicorn/issues/2382 + LOG_FMT = "%(asctime)s - %(otelTraceID)s - %(threadName)s - %(message)s" + logger = logging.getLogger("uvicorn.access") + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter(LOG_FMT)) + logger.handlers = [handler] diff --git a/pyproject.toml b/pyproject.toml index b6e726b01..c9b961aa4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "keep" -version = "0.34.6" +version = "0.34.7" description = "Alerting. for developers, by developers." authors = ["Keep Alerting LTD"] packages = [{include = "keep"}]