From 07c3c287f75f0148fa6fc2da99377ab9b75b45dd Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Sun, 15 May 2016 11:13:58 +0200 Subject: [PATCH] Fix regression causing the default log level to become WARNING Change I96229438d3a2271c830bcd926326e7b4a94ccac9 removed the verbose option in the opposite fashion from what how it was intended when the option was deprecated. It regressed the default log level back to WARNING. See change I306535c6ca5dbdaf9398b44697578a3a30e52111 for original reasoning behind this deprecation. This change fixes the default level as it was intended. Change-Id: Ia9cd55004ce05761de733adae00554ff021794a8 --- oslo_log/log.py | 2 +- oslo_log/tests/unit/test_log.py | 8 ++++---- releasenotes/notes/info-logging-7b7be9fc7a95aebc.yaml | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/info-logging-7b7be9fc7a95aebc.yaml diff --git a/oslo_log/log.py b/oslo_log/log.py index dabce127..3d870520 100644 --- a/oslo_log/log.py +++ b/oslo_log/log.py @@ -322,7 +322,7 @@ def _refresh_root_level(debug): if debug: log_root.setLevel(logging.DEBUG) else: - log_root.setLevel(logging.WARNING) + log_root.setLevel(logging.INFO) def _setup_logging_from_conf(conf, project, version): diff --git a/oslo_log/tests/unit/test_log.py b/oslo_log/tests/unit/test_log.py index 77df9ed8..b1c69d84 100644 --- a/oslo_log/tests/unit/test_log.py +++ b/oslo_log/tests/unit/test_log.py @@ -97,12 +97,12 @@ class CommonLoggerTestsMixIn(object): logger = logging.getLogger(logger_name) self.assertEqual(logging.DEBUG, logger.getEffectiveLevel()) - def test_will_be_warning_if_debug_flag_not_set(self): + def test_will_be_info_if_debug_flag_not_set(self): self.config(debug=False) logger_name = 'test_is_not_debug' log.setup(self.CONF, logger_name) logger = logging.getLogger(logger_name) - self.assertEqual(logging.WARNING, logger.getEffectiveLevel()) + self.assertEqual(logging.INFO, logger.getEffectiveLevel()) def test_no_logging_via_module(self): for func in ('critical', 'error', 'exception', 'warning', 'warn', @@ -831,7 +831,7 @@ class FastWatchedFileHandlerTestCase(BaseTestCase): log_path = self._config() logger = log._loggers[None].logger text = 'Hello World!' - logger.warning(text) + logger.info(text) with open(log_path, 'r') as f: file_content = f.read() self.assertTrue(text in file_content) @@ -865,7 +865,7 @@ class ConfigTestCase(test_base.BaseTestCase): log._setup_logging_from_conf(conf, 'test', 'test') self.assertEqual(conf.debug, False) - self.assertEqual(log.WARN, log_root.getEffectiveLevel()) + self.assertEqual(log.INFO, log_root.getEffectiveLevel()) shutil.copy(paths[1], paths[0]) conf.mutate_config_files() diff --git a/releasenotes/notes/info-logging-7b7be9fc7a95aebc.yaml b/releasenotes/notes/info-logging-7b7be9fc7a95aebc.yaml new file mode 100644 index 00000000..935d35fb --- /dev/null +++ b/releasenotes/notes/info-logging-7b7be9fc7a95aebc.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - When removing the "verbose" option, the default logging level was set to + "WARNING" by mistake. Fixed it back to "INFO".