2015-04-07 21:09:39 |
Csaba Henk |
description |
The following anti-pattern is frequent across Manila source:
msg = ("The number of %(bar)ses found is %(quux)d that exceeds limit %(lim)d.", {"bar": "wooz", "quux": 14, "lim": 9})
LOG.error(msg)
raise exception.BarQuuxException(message=msg)
This results in actual messages like:
ERROR <component> (u'The number of %(bar)ses found is %(quux)d that exceeds limit %(lim)d.', {'bar': 'wooz', 'quux': 14, limit: 9})
...
TRACE <component> BarQuuxException: ("The number of %(bar)s found is %(quux)d that exceeds limit %(lim)d.", {"bar": "wooz", "quux": 14, "lim": 9})
While a properly formatted message would be:
The number of wooz found is 14 that exceeds limit 9.
("The number of %(bar)s found is %(quux)d that exceeds limit %(lim)d", {"bar": "wooz", "quux": 14, "lim": 9})
For a real life example please see the attachment of https://bugs.launchpad.net/manila/+bug/1417352,
https://launchpadlibrarian.net/198010156/manila-bug-1417352-stacktrace.txt |
The following anti-pattern is frequent across Manila source:
msg = ("The number of %(bar)ses found is %(quux)d that exceeds limit %(lim)d.", {"bar": "wooz", "quux": 14, "lim": 9})
LOG.error(msg)
raise exception.BarQuuxException(message=msg)
This results in actual messages like:
ERROR <component> (u'The number of %(bar)ses found is %(quux)d that exceeds limit %(lim)d.', {'bar': 'wooz', 'quux': 14, 'lim': 9})
...
TRACE <component> BarQuuxException: ("The number of %(bar)ses found is %(quux)d that exceeds limit %(lim)d.", {"bar": "wooz", "quux": 14, "lim": 9})
While a properly formatted message would be:
The number of woozes found is 14 that exceeds limit 9.
For a real life example please see the attachment of https://bugs.launchpad.net/manila/+bug/1417352,
https://launchpadlibrarian.net/198010156/manila-bug-1417352-stacktrace.txt |
|