From c99493952b917ff4ff3da5456bc978711d5e2aaa Mon Sep 17 00:00:00 2001 From: Ephraim Anierobi Date: Fri, 17 Jul 2026 11:47:11 +0100 Subject: [PATCH] Suppress noisy Alembic plugin setup logs Alembic emits autogenerate plugin registration messages at INFO during CLI startup. Those unrelated lines contaminate machine-readable command output, while warnings and errors still need to remain visible. --- .../logging/src/airflow_shared/logging/structlog.py | 1 + shared/logging/tests/logging/test_structlog.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/shared/logging/src/airflow_shared/logging/structlog.py b/shared/logging/src/airflow_shared/logging/structlog.py index 72884cfbde7b6..1c4341e99e520 100644 --- a/shared/logging/src/airflow_shared/logging/structlog.py +++ b/shared/logging/src/airflow_shared/logging/structlog.py @@ -709,6 +709,7 @@ def is_atty(): # These ones are too chatty even at info "httpx": {"level": "WARN"}, "sqlalchemy.engine": {"level": "WARN"}, + "alembic.runtime.plugins": {"level": "WARN"}, } ) config["root"] = { diff --git a/shared/logging/tests/logging/test_structlog.py b/shared/logging/tests/logging/test_structlog.py index ca85bb4f20e81..cf63d2ed7788a 100644 --- a/shared/logging/tests/logging/test_structlog.py +++ b/shared/logging/tests/logging/test_structlog.py @@ -464,6 +464,19 @@ def test_logger_respects_configured_level(structlog_config): assert "[my_logger] Debug message\n" in written +def test_alembic_runtime_plugin_setup_logs_are_suppressed(structlog_config): + with structlog_config( + colors=False, + log_format="[%(name)s] %(message)s", + log_level="INFO", + ) as sio: + logger = logging.getLogger("alembic.runtime.plugins") + logger.info("Filtered plugin setup message") + logger.warning("Visible warning") + + assert sio.getvalue() == "[alembic.runtime.plugins] Visible warning\n" + + def test_excepthook_installed_when_json_output_true(structlog_config): import sys