diff options
| author | Angus Salkeld <asalkeld@redhat.com> | 2012-11-13 11:38:17 +1100 |
|---|---|---|
| committer | Angus Salkeld <asalkeld@redhat.com> | 2012-11-13 11:40:28 +1100 |
| commit | ed9af33c037f05af61b3581a9b3999dd7e5ecfcb (patch) | |
| tree | fc45fca8b913316236aa51ba330bdf24c0ef8914 | |
| parent | 5e3c7b50398bd79cf4103f062584c12efc685451 (diff) | |
| download | oslo-ed9af33c037f05af61b3581a9b3999dd7e5ecfcb.tar.gz oslo-ed9af33c037f05af61b3581a9b3999dd7e5ecfcb.tar.xz oslo-ed9af33c037f05af61b3581a9b3999dd7e5ecfcb.zip | |
Fix the log test so it uses the available context fields.
logging_context_format_string in log.py references fields
that don't exist in the common/context.py so we get errors
like:
---
File "/usr/lib64/python2.7/logging/__init__.py", line 467, in format
s = self._fmt % record.__dict__
KeyError: 'project_id'
Logged from file test_log.py, line 42
---
We could change the defaults in log.py but that might cause
too much disruption to other projects.
Change-Id: Ic3f6039baccb522b5eb2462a87b792c226ca13ef
| -rw-r--r-- | tests/unit/test_log.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unit/test_log.py b/tests/unit/test_log.py index 2530339..f9c6e4c 100644 --- a/tests/unit/test_log.py +++ b/tests/unit/test_log.py @@ -22,6 +22,13 @@ def _fake_context(): class LoggerTestCase(test_utils.BaseTestCase): def setUp(self): super(LoggerTestCase, self).setUp() + + # common context has different fields to the defaults in log.py + self.config(logging_context_format_string='%(asctime)s %(levelname)s ' + '%(name)s [%(request_id)s ' + '%(user)s %(tenant)s] ' + '%(message)s') + self.log = log.getLogger() def test_handlers_have_legacy_formatter(self): |
