From 9fa2826a11321de1aaddb48534ce826721125979 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Sat, 30 May 2026 16:34:27 -0400 Subject: [PATCH] Fixed stack trace logging regression on stderr --- ceopardy/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ceopardy/__init__.py b/ceopardy/__init__.py index a3ffde5..bdee236 100644 --- a/ceopardy/__init__.py +++ b/ceopardy/__init__.py @@ -150,12 +150,18 @@ def on_disconnect(): def create_app(): - # Logging + # Logging — both to file (full DEBUG) and to stderr (INFO+) so app errors + # (notably the /init traceback) show up in the terminal running the server. + fmt = logging.Formatter("{asctime} {levelname}: {message} [in {pathname}:{lineno}]", style="{") file_handler = logging.FileHandler("ceopardy.log") file_handler.setLevel(logging.DEBUG) - fmt = logging.Formatter("{asctime} {levelname}: {message} [in {pathname}:{lineno}]", style="{") file_handler.setFormatter(fmt) app.logger.addHandler(file_handler) + stream_handler = logging.StreamHandler() + stream_handler.setLevel(logging.INFO) + stream_handler.setFormatter(fmt) + app.logger.addHandler(stream_handler) + app.logger.setLevel(logging.DEBUG) with app.app_context(): # Hand a couple of things on the app object so modules that don't