diff --git a/backend/app/logging/setup_logging.py b/backend/app/logging/setup_logging.py index 0eedecaa9..8e19eb7bc 100644 --- a/backend/app/logging/setup_logging.py +++ b/backend/app/logging/setup_logging.py @@ -235,9 +235,14 @@ def emit(self, record: logging.LogRecord) -> None: Args: record: The log record to process """ - # Get the appropriate module name + # Get the appropriate module name. Uvicorn uses logger names such as + # ``uvicorn.error`` for regular server lifecycle messages, so avoid + # reducing those names to just ``error`` because that makes INFO logs + # look like failures in the formatted output. module_name = record.name - if "." in module_name: + if module_name.startswith("uvicorn"): + module_name = "uvicorn" + elif "." in module_name: module_name = module_name.split(".")[-1] # Create a message that includes the original module in the format diff --git a/sync-microservice/app/logging/setup_logging.py b/sync-microservice/app/logging/setup_logging.py index fad815908..89e49529a 100644 --- a/sync-microservice/app/logging/setup_logging.py +++ b/sync-microservice/app/logging/setup_logging.py @@ -243,9 +243,14 @@ def emit(self, record: logging.LogRecord) -> None: Args: record: The log record to process """ - # Get the appropriate module name + # Get the appropriate module name. Uvicorn uses logger names such as + # ``uvicorn.error`` for regular server lifecycle messages, so avoid + # reducing those names to just ``error`` because that makes INFO logs + # look like failures in the formatted output. module_name = record.name - if "." in module_name: + if module_name.startswith("uvicorn"): + module_name = "uvicorn" + elif "." in module_name: module_name = module_name.split(".")[-1] # Create a message that includes the original module in the format