From feba372e2d26a08baf94c3918608f91071584ecd Mon Sep 17 00:00:00 2001 From: Oliver Walsh Date: Fri, 28 Jul 2023 11:33:20 +0100 Subject: [PATCH] Drop lack of syslog warning to debug level logging The current warning spams openstackclient output with multiple log messages (one for every call to getLogger in the entrypoints that are loaded). Drop the message to debug level. Resolves: rhbz#2227201 Change-Id: Ib32146020f5869c88cc8becf41c9245a0c4863c3 --- validations_libs/logger.py | 2 +- validations_libs/tests/test_logger.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/validations_libs/logger.py b/validations_libs/logger.py index 4cc08c58..1ec7e91e 100644 --- a/validations_libs/logger.py +++ b/validations_libs/logger.py @@ -42,6 +42,6 @@ def getLogger(loggerName, stream_lvl=logging.WARN): new_logger.addHandler(sys_handler) else: - new_logger.warning("Journal socket does not exist. Logs will not be processed by syslog.") + new_logger.debug("Journal socket does not exist. Logs will not be processed by syslog.") return new_logger diff --git a/validations_libs/tests/test_logger.py b/validations_libs/tests/test_logger.py index c1211445..b6d6c216 100644 --- a/validations_libs/tests/test_logger.py +++ b/validations_libs/tests/test_logger.py @@ -35,10 +35,10 @@ class TestLogger(TestCase): mock_exists.assert_called_once_with('/dev/log') self.assertEqual(logging.Logger, type(new_logger)) - @mock.patch('logging.Logger.warning') + @mock.patch('logging.Logger.debug') @mock.patch('os.path.exists', return_value=False) - def test_logger_init_no_journal(self, mock_exists, mock_warning): + def test_logger_init_no_journal(self, mock_exists, mock_debug): new_logger = logger.getLogger("fooo") mock_exists.assert_called_once_with('/dev/log') - mock_warning.assert_called_once() + mock_debug.assert_called_once() self.assertEqual(logging.Logger, type(new_logger))