From 16da4d851e68c93e4c41c1133192b9f6447a6cd5 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 25 Oct 2016 21:08:54 +0100 Subject: [PATCH] [#2850] Fix duplicate ui log entries --- deluge/log.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deluge/log.py b/deluge/log.py index 35513c066..d8e98a458 100644 --- a/deluge/log.py +++ b/deluge/log.py @@ -151,7 +151,14 @@ def setup_logger(level="error", filename=None, filemode="w", logrotate=None, twi ) handler.setFormatter(formatter) - root_logger.addHandler(handler) + + # Check for existing handler to prevent duplicate logging. + if root_logger.handlers: + for handle in root_logger.handlers: + if not isinstance(handle, type(handler)): + root_logger.addHandler(handler) + else: + root_logger.addHandler(handler) root_logger.setLevel(level) if twisted_observer: