summaryrefslogtreecommitdiff
path: root/oslo_log/tests/unit/test_log.py
diff options
context:
space:
mode:
authorBenjamin Reichel <b.reichel@syseleven.de>2020-04-09 15:02:20 +0200
committerBenjamin Reichel <b.reichel@syseleven.de>2020-05-25 17:16:56 +0200
commit65ee5f5bbb3ec759bfa1bf1dbccb02c3b348bad0 (patch)
treeb77818d31e91cb734a1dccbef20ee72b3b00ac01 /oslo_log/tests/unit/test_log.py
parent2f8169185f99c87a22d9af5e45075b928596987d (diff)
downloadoslo-log-65ee5f5bbb3ec759bfa1bf1dbccb02c3b348bad0.tar.gz
Add missing SYSLOG_FACILITY to JournalHandler3.44.2
Without SYSLOG_FACILITY log messages from journald forwards the message to kern.log. This seems to be default behaviour as it treats the message as kernel message. This option provides a proper facility to the log message and kern.log will not be filled up anymore. Cherry-picked from commit 5b12e66f6283962d96884e4aa3fa7db7d4e062fa Cherry-picked from commit 82751ce2a2b913a5d107133a15960c9c6d8fd594 Change-Id: I62a32ed46a400b62ead8c1e6e64acee658e2a769 Closes-Bug: #1871840
Diffstat (limited to 'oslo_log/tests/unit/test_log.py')
-rw-r--r--oslo_log/tests/unit/test_log.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/oslo_log/tests/unit/test_log.py b/oslo_log/tests/unit/test_log.py
index 76f614a..9ff58cf 100644
--- a/oslo_log/tests/unit/test_log.py
+++ b/oslo_log/tests/unit/test_log.py
@@ -403,6 +403,7 @@ class OSJournalHandlerTestCase(BaseTestCase):
mock.call(mock.ANY, CODE_FILE=mock.ANY, CODE_FUNC='test_emit',
CODE_LINE=mock.ANY, LOGGER_LEVEL='INFO',
LOGGER_NAME='nova-test.foo', PRIORITY=6,
+ SYSLOG_FACILITY=syslog.LOG_USER,
SYSLOG_IDENTIFIER=mock.ANY,
REQUEST_ID=mock.ANY,
PROJECT_NAME='mytenant',
@@ -415,7 +416,8 @@ class OSJournalHandlerTestCase(BaseTestCase):
self.assertIsInstance(args[0], six.string_types)
self.assertIsInstance(kwargs['CODE_LINE'], int)
self.assertIsInstance(kwargs['PRIORITY'], int)
- del kwargs['CODE_LINE'], kwargs['PRIORITY']
+ self.assertIsInstance(kwargs['SYSLOG_FACILITY'], int)
+ del kwargs['CODE_LINE'], kwargs['PRIORITY'], kwargs['SYSLOG_FACILITY']
for key, arg in kwargs.items():
self.assertIsInstance(key, six.string_types)
self.assertIsInstance(arg, six.string_types + (six.binary_type,))
@@ -432,6 +434,7 @@ class OSJournalHandlerTestCase(BaseTestCase):
CODE_FUNC='test_emit_exception',
CODE_LINE=mock.ANY, LOGGER_LEVEL='ERROR',
LOGGER_NAME='nova-exception.foo', PRIORITY=3,
+ SYSLOG_FACILITY=syslog.LOG_USER,
SYSLOG_IDENTIFIER=mock.ANY,
REQUEST_ID=mock.ANY,
EXCEPTION_INFO=mock.ANY,
@@ -446,7 +449,8 @@ class OSJournalHandlerTestCase(BaseTestCase):
self.assertIsInstance(args[0], six.string_types)
self.assertIsInstance(kwargs['CODE_LINE'], int)
self.assertIsInstance(kwargs['PRIORITY'], int)
- del kwargs['CODE_LINE'], kwargs['PRIORITY']
+ self.assertIsInstance(kwargs['SYSLOG_FACILITY'], int)
+ del kwargs['CODE_LINE'], kwargs['PRIORITY'], kwargs['SYSLOG_FACILITY']
for key, arg in kwargs.items():
self.assertIsInstance(key, six.string_types)
self.assertIsInstance(arg, six.string_types + (six.binary_type,))