From 78dd0308515086d0aafc2e050553743b48082609 Mon Sep 17 00:00:00 2001 From: Nicholas Devenish Date: Tue, 25 Nov 2025 16:56:24 +0000 Subject: [PATCH] configure_rabbitmq: Always output to stdout handler --- HISTORY.rst | 4 ++++ src/zocalo/cli/configure_rabbitmq.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 62accce..ee0fc29 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,10 @@ History ======= +Unreleased +---------- +- Fixed blank output from ``zocalo.configure_rabbitmq`` when zocalo logging is configured. (`#286 `) + 1.3.0 (2025-07-04) ------------------ - Minimum supported python is now 3.11. diff --git a/src/zocalo/cli/configure_rabbitmq.py b/src/zocalo/cli/configure_rabbitmq.py index 50cecf5..ac33e04 100644 --- a/src/zocalo/cli/configure_rabbitmq.py +++ b/src/zocalo/cli/configure_rabbitmq.py @@ -386,6 +386,8 @@ def _configure_users(api, rabbitmq_user_config_area: Path): def run(): logging.basicConfig(level=logging.INFO, format="%(message)s") + handler = logging.getLogger().handlers[0] + zc = zocalo.configuration.from_file() zc.activate() parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) @@ -405,6 +407,10 @@ def run(): zc.add_command_line_options(parser) args = parser.parse_args() + # Zocalo config can remove the handler, hiding errors + if handler not in logging.getLogger().handlers: + logging.getLogger().addHandler(handler) + api = RabbitMQAPI.from_zocalo_configuration(zc) with open(args.configuration) as in_file: