[openstack-dev] [All] Removing translations from debug logging where exception formatted into the message
kuvaja at hp.com
Thu Jun 26 18:56:41 UTC 2014
We hit nasty situation where _() was removed from DEBUG level logging and there is exception included like following:
msg = "Forbidden upload attempt: %s" % e
This caused gettextutils raising UnicodeError:
2014-06-26 18:16:24.221 | File "glance/openstack/common/gettextutils.py", line 333, in __str__
2014-06-26 18:16:24.222 | raise UnicodeError(msg)
2014-06-26 18:16:24.222 | UnicodeError: Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.
(For Example http://logs.openstack.org/63/102863/1/check/gate-glance-python27/6ad16a3/console.html#_2014-06-26_15_57_12_262)
As discussed with mriedm, jecarey and dhellmann on #openstack-oslo this can be avoided by specifying the message being unicode like:
msg = u"Forbidden upload attempt: %s" % e
For us in Glance it caused bunch of gating issues, so hopefully this helps the rest of the projects avoiding same, or at least tackling it bit faster.
- Erno (jokke_) Kuvaja
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OpenStack-dev