Commit 6346a9e5 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

utils.SetupLogging: Remove previously setup handlers

If a logging function is called before the logging module is setup
using utils.SetupLogging, it calls logging.basicConfig, which adds
a StreamHandler, on its own. If we leave it in, all log output will
be printed twice on stderr. This patch makes sure to remove all
handlers before adding our own.

Reviewed-by: iustinp
parent a3811745
......@@ -1558,6 +1558,10 @@ def SetupLogging(logfile, debug=False, stderr_logging=False, program=""):
root_logger = logging.getLogger("")
# Remove all previously setup handlers
for handler in root_logger.handlers:
if stderr_logging:
stderr_handler = logging.StreamHandler()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment