aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-04-27 15:43:38 -0400
committerJake Hunsaker <jhunsake@redhat.com>2020-04-28 15:29:51 -0400
commitab443738f139cbee114aa96dd8d3b89089c7f927 (patch)
tree5ccd50c88d26f477f12f54cb41ea2e16107abfbd
parent1417827a9efd84860cb9e30a449faff7d55bb4fb (diff)
downloadsos-ab443738f139cbee114aa96dd8d3b89089c7f927.tar.gz
[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 <jhunsake@redhat.com>
-rw-r--r--sos/component.py4
1 files changed, 3 insertions, 1 deletions
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)