From 073d78c43477325636f054b69a750f7023fcd51e Mon Sep 17 00:00:00 2001 From: sawarn24 Date: Mon, 5 Jan 2026 00:34:24 +0530 Subject: [PATCH 1/4] Fix infinite recursion in InterceptHandler logging --- backend/app/logging/setup_logging.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/app/logging/setup_logging.py b/backend/app/logging/setup_logging.py index e64424654..8f230b0ca 100644 --- a/backend/app/logging/setup_logging.py +++ b/backend/app/logging/setup_logging.py @@ -243,11 +243,13 @@ def emit(self, record: logging.LogRecord) -> None: # Create a message that includes the original module in the format msg = record.getMessage() - # Find the appropriate logger - logger = get_logger(module_name) + record.msg = f"[uvicorn] {msg}" + record.args = () - # Log the message with our custom formatting - logger.log(record.levelno, f"[uvicorn] {msg}") + root_logger = logging.getLogger() + for handler in root_logger.handlers: + if handler is not self: + handler.handle(record) def configure_uvicorn_logging(component_name: str) -> None: From e993f70c3e3d93cfaeddc17e444bf2dfb671b129 Mon Sep 17 00:00:00 2001 From: sawarn24 Date: Mon, 5 Jan 2026 01:01:23 +0530 Subject: [PATCH 2/4] Fix infinite recursion in InterceptHandler logging --- backend/app/logging/setup_logging.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/logging/setup_logging.py b/backend/app/logging/setup_logging.py index 8f230b0ca..886032deb 100644 --- a/backend/app/logging/setup_logging.py +++ b/backend/app/logging/setup_logging.py @@ -245,11 +245,14 @@ def emit(self, record: logging.LogRecord) -> None: record.msg = f"[uvicorn] {msg}" record.args = () + # Clear exception / stack info to avoid duplicate traces + record.exc_info = None + record.stack_info = None root_logger = logging.getLogger() for handler in root_logger.handlers: - if handler is not self: - handler.handle(record) + if handler is not self: + handler.handle(record) def configure_uvicorn_logging(component_name: str) -> None: From 4910a4adab0784e34de76a39b635082bbcfae36a Mon Sep 17 00:00:00 2001 From: sawarn24 Date: Mon, 5 Jan 2026 01:18:44 +0530 Subject: [PATCH 3/4] Fix infinite recursion in InterceptHandler with dynamic log prefix --- backend/app/logging/setup_logging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/logging/setup_logging.py b/backend/app/logging/setup_logging.py index 886032deb..0eedecaa9 100644 --- a/backend/app/logging/setup_logging.py +++ b/backend/app/logging/setup_logging.py @@ -243,7 +243,7 @@ def emit(self, record: logging.LogRecord) -> None: # Create a message that includes the original module in the format msg = record.getMessage() - record.msg = f"[uvicorn] {msg}" + record.msg = f"[{module_name}] {msg}" record.args = () # Clear exception / stack info to avoid duplicate traces record.exc_info = None From f0f9107247c4b881c8a6e40b65f3d403a8289ce1 Mon Sep 17 00:00:00 2001 From: sawarn24 Date: Tue, 6 Jan 2026 20:48:56 +0530 Subject: [PATCH 4/4] Fix recursive logging in sync microservice InterceptHandler --- sync-microservice/app/logging/setup_logging.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sync-microservice/app/logging/setup_logging.py b/sync-microservice/app/logging/setup_logging.py index b3e91ad35..fad815908 100644 --- a/sync-microservice/app/logging/setup_logging.py +++ b/sync-microservice/app/logging/setup_logging.py @@ -251,11 +251,16 @@ def emit(self, record: logging.LogRecord) -> None: # Create a message that includes the original module in the format msg = record.getMessage() - # Find the appropriate logger - logger = get_logger(module_name) - - # Log the message with our custom formatting - logger.log(record.levelno, f"[uvicorn] {msg}") + record.msg = f"[{module_name}] {msg}" + record.args = () + # Clear exception / stack info to avoid duplicate traces + record.exc_info = None + record.stack_info = None + + root_logger = logging.getLogger() + for handler in root_logger.handlers: + if handler is not self: + handler.handle(record) def configure_uvicorn_logging(component_name: str) -> None: