From 9ac99e9126397ac7daa282960005c89a94b82c78 Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Fri, 5 Jun 2026 14:47:12 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(backend)=20backport=20logging=20co?= =?UTF-8?q?nfiguration=20from=20docs=20Backport=20the=20logging=20configur?= =?UTF-8?q?ation=20from=20docs=20to=20LaSuite=20Meet=20after=20discussion?= =?UTF-8?q?=20with=20@lunika.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a proper base logging setup to restore usable logs in production. The initial repository bootstrap lacked a complete logging configuration, resulting in limited operational visibility. Note that I have explicitely set the output to stdout to make sure it shows up in Grafana. --- src/backend/dictaphone/settings.py | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/backend/dictaphone/settings.py b/src/backend/dictaphone/settings.py index 61bdb99..fd38a02 100755 --- a/src/backend/dictaphone/settings.py +++ b/src/backend/dictaphone/settings.py @@ -754,6 +754,45 @@ class Base(Configuration): "BLACKLIST_AFTER_ROTATION": True, } + # Logging + # We want to make it easy to log to console but by default we log production + # to Sentry and don't want to log to console. + LOGGING = { + "version": 1, + "disable_existing_loggers": False, + "formatters": { + "simple": { + "format": "{asctime} {name} {levelname} {message}", + "style": "{", + }, + }, + "handlers": { + "console": { + "class": "logging.StreamHandler", + "formatter": "simple", + "stream": "ext://sys.stdout", + }, + }, + # Override root logger to send it to console + "root": { + "handlers": ["console"], + "level": values.Value( + "INFO", environ_name="LOGGING_LEVEL_LOGGERS_ROOT", environ_prefix=None + ), + }, + "loggers": { + "core": { + "handlers": ["console"], + "level": values.Value( + "INFO", + environ_name="LOGGING_LEVEL_LOGGERS_APP", + environ_prefix=None, + ), + "propagate": False, + }, + }, + } + # pylint: disable=invalid-name @property def ENVIRONMENT(self):