diff options
-rw-r--r-- | man/en/sos.1 | 8 | ||||
-rw-r--r-- | sos/archive.py | 1 | ||||
-rw-r--r-- | sos/component.py | 4 | ||||
-rw-r--r-- | tests/report_tests/basic_report_tests.py | 21 |
4 files changed, 30 insertions, 4 deletions
diff --git a/man/en/sos.1 b/man/en/sos.1 index 2aee4ede..473c0551 100644 --- a/man/en/sos.1 +++ b/man/en/sos.1 @@ -116,6 +116,14 @@ Specify the number of threads sosreport will use for concurrency. Defaults to 4. .B \-v, \--verbose Increase logging verbosity. May be specified multiple times to enable additional debugging messages. + +The following table summarizes the effects of different verbosity levels: + + 1 (-v) : Enable debug messages for sos.log. Show individual plugins starting. + 2 (-vv) : Also print debug messages to console. + 3 (-vvv) : Enable debug messages for archive file operations. Note this will dramatically + increase the amount of logging. + .TP .B \-q, \--quiet Only log fatal errors to stderr. diff --git a/sos/archive.py b/sos/archive.py index b74f905a..421f993c 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -476,7 +476,6 @@ class FileCacheArchive(Archive): else: self.log_debug("No link follow up: source=%s link_name=%s" % (source, link_name)) - self.log_debug("leaving add_link()") def add_dir(self, path): """Create a directory in the archive. diff --git a/sos/component.py b/sos/component.py index 223c3812..e0dfc166 100644 --- a/sos/component.py +++ b/sos/component.py @@ -256,7 +256,7 @@ class SoSComponent(): enc_opts, self.sysroot, self.manifest) - self.archive.set_debug(True if self.opts.debug else False) + self.archive.set_debug(self.opts.verbosity > 2) def _setup_logging(self): """Creates the log handler that shall be used by all components and any @@ -283,7 +283,7 @@ class SoSComponent(): if flog: flog.setLevel(logging.DEBUG) elif self.opts.verbosity and self.opts.verbosity > 0: - console.setLevel(logging.INFO) + console.setLevel(logging.WARNING) if flog: flog.setLevel(logging.DEBUG) else: diff --git a/tests/report_tests/basic_report_tests.py b/tests/report_tests/basic_report_tests.py index 0cf5bd4e..4a5e0001 100644 --- a/tests/report_tests/basic_report_tests.py +++ b/tests/report_tests/basic_report_tests.py @@ -15,11 +15,15 @@ class NormalSoSReport(StageOneReportTest): :avocado: tags=stageone """ - sos_cmd = '-vvv --label thisismylabel' + sos_cmd = '-v --label thisismylabel' def test_debug_in_logs_verbose(self): self.assertSosLogContains('DEBUG') + def test_debug_not_printed_to_console(self): + self.assertOutputNotContains('added cmd output') + self.assertOutputNotContains('\[archive:.*\]') + def test_postproc_called(self): self.assertSosLogContains('substituting scrpath') @@ -30,6 +34,21 @@ class NormalSoSReport(StageOneReportTest): self.assertFileCollected('free') +class LogLevelTest(StageOneReportTest): + """ + :avocado: tags=stageone + """ + + sos_cmd = '-vvv' + + def test_archive_logging_enabled(self): + self.assertSosLogContains('DEBUG: \[archive:.*\]') + self.assertSosLogContains('Making leading paths for') + + def test_debug_printed_to_console(self): + self.assertOutputContains('\[plugin:.*\]') + + class RestrictedSoSReport(StageOneReportTest): """ :avocado: tags=stageone |