From 8454b91641543b18956a861301446459a27ae79f Mon Sep 17 00:00:00 2001 From: Matthias Neugebauer Date: Fri, 17 May 2024 11:02:38 +0200 Subject: [PATCH] Clear logging handler when initializing the logger --- pyca/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyca/config.py b/pyca/config.py index 539ebf1..fe5c591 100644 --- a/pyca/config.py +++ b/pyca/config.py @@ -170,6 +170,8 @@ def logger_init(): handlers.append(logging.StreamHandler(sys.stderr)) if logconf['file']: handlers.append(logging.handlers.WatchedFileHandler(logconf['file'])) + if logging.root.hasHandlers(): + logging.root.handlers.clear() for handler in handlers: handler.setFormatter(logging.Formatter(logconf['format'])) logging.root.addHandler(handler)