aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2012-12-04 21:23:11 +0000
committerBryn M. Reeves <bmr@redhat.com>2012-12-04 21:23:11 +0000
commit38f2b83b51d5da7ef7d5cde593c76cfdc2631fdf (patch)
tree21b099efbed839b08504aa69e25f16ba10c993a7
parentb8f3d9ddaa8ac8d740f7d1a4fa28e18c710e2e5c (diff)
downloadsos-38f2b83b51d5da7ef7d5cde593c76cfdc2631fdf.tar.gz
Fix verbose logging
Propagate soslog and proflog objects to plugins properly and ensure debug logging makes it to sos.log when verbose mode is enabled.
-rw-r--r--sos/plugins/__init__.py4
-rw-r--r--sos/sosreport.py5
2 files changed, 7 insertions, 2 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 048d2149..d930c9ef 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -140,8 +140,8 @@ class Plugin(object):
self.must_exit = False
- self.soslog = logging.getLogger('sos')
- self.proflog = logging.getLogger('sosprofile')
+ self.soslog = self.cInfo['soslog']
+ self.proflog = self.cInfo['proflog']
# get the option list into a dictionary
for opt in self.optionList:
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 1fd83efa..b8c216b4 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -229,6 +229,7 @@ class SoSReport(object):
'logdir': self.logdir,
'rptdir': self.rptdir,
'soslog': self.soslog,
+ 'proflog' : self.proflog,
'policy': self.policy,
'verbosity': self.opts.verbosity,
'xmlreport': self.xml_report,
@@ -326,6 +327,7 @@ class SoSReport(object):
console.setFormatter(logging.Formatter('%(message)s'))
if self.opts.verbosity > 1:
console.setLevel(logging.DEBUG)
+ flog.setLevel(logging.DEBUG)
elif self.opts.verbosity > 0:
console.setLevel(logging.INFO)
else:
@@ -357,6 +359,9 @@ class SoSReport(object):
plog.setFormatter(logging.Formatter('%(message)s'))
plog.setLevel(logging.DEBUG)
self.proflog.addHandler(plog)
+ else:
+ self.proflog = logging.getLogger('sosprofile')
+ self.proflog.setLevel(logging.FATAL)
def _finish_logging(self):
logging.shutdown()