From ab443738f139cbee114aa96dd8d3b89089c7f927 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Mon, 27 Apr 2020 15:43:38 -0400 Subject: [sos] Don't double log error level messages Only set the logging handler that prints ERROR level messages to console if we're running in quiet mode, as otherwise we'll double log from the normal console handler. Closes: #1999 Resolves: #2033 Signed-off-by: Jake Hunsaker --- sos/component.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sos/component.py b/sos/component.py index dbc7336f..6b99986b 100644 --- a/sos/component.py +++ b/sos/component.py @@ -202,7 +202,9 @@ class SoSComponent(): else: console.setLevel(logging.WARNING) self.soslog.addHandler(console) - # log ERROR or higher logs to stderr instead + # still log ERROR level message to console, but only setup this handler + # when --quiet is used, as otherwise we'll double log + else: console_err = logging.StreamHandler(sys.stderr) console_err.setFormatter(logging.Formatter('%(message)s')) console_err.setLevel(logging.ERROR) -- cgit