From 3af7c6843f653760d3010c2f74214706c52e7141 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Wed, 12 Jun 2019 16:57:50 +0200 Subject: [sosreport] log warning messages to stdout instead of stderr warning and lower priority logs should be logged to stdout error or higher logs should be logged to stderr Signed-off-by: Pavel Moravec --- sos/sosreport.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sos/sosreport.py b/sos/sosreport.py index 723e3e58..f186256a 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -457,7 +457,7 @@ class SoSReport(object): self.soslog.addHandler(flog) if not self.opts.quiet: - console = logging.StreamHandler(sys.stderr) + console = logging.StreamHandler(sys.stdout) console.setFormatter(logging.Formatter('%(message)s')) if self.opts.verbosity and self.opts.verbosity > 1: console.setLevel(logging.DEBUG) @@ -468,6 +468,11 @@ class SoSReport(object): else: console.setLevel(logging.WARNING) self.soslog.addHandler(console) + # log ERROR or higher logs to stderr instead + console_err = logging.StreamHandler(sys.stderr) + console_err.setFormatter(logging.Formatter('%(message)s')) + console_err.setLevel(logging.ERROR) + self.soslog.addHandler(console_err) # ui log self.ui_log = logging.getLogger('sos_ui') -- cgit