diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-30 15:23:27 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-30 15:23:27 +0000 |
| commit | e0134fc3e2d7e59741b3643e2680f578cc9def41 (patch) | |
| tree | 4b433f834a064e863380ccb8eea438e5d68f4c8c /openstack | |
| parent | 7f56ee6719b30b2fa76b5d43447e74e395321e05 (diff) | |
| parent | 14088fb6e43676b2bfbbcd96bc78740ee862c550 (diff) | |
| download | oslo-e0134fc3e2d7e59741b3643e2680f578cc9def41.tar.gz oslo-e0134fc3e2d7e59741b3643e2680f578cc9def41.tar.xz oslo-e0134fc3e2d7e59741b3643e2680f578cc9def41.zip | |
Merge "don't throw exceptions if %(color)s tag is used"
Diffstat (limited to 'openstack')
| -rw-r--r-- | openstack/common/log.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openstack/common/log.py b/openstack/common/log.py index 8a368a1..5f0478f 100644 --- a/openstack/common/log.py +++ b/openstack/common/log.py @@ -405,8 +405,12 @@ class LegacyFormatter(logging.Formatter): def format(self, record): """Uses contextstring if request_id is set, otherwise default.""" - if 'instance' not in record.__dict__: - record.__dict__['instance'] = '' + # NOTE(sdague): default the fancier formating params + # to an empty string so we don't throw an exception if + # they get used + for key in ('instance', 'color'): + if key not in record.__dict__: + record.__dict__[key] = '' if record.__dict__.get('request_id', None): self._fmt = CONF.logging_context_format_string |
