UnicodeDecodeError in log when message includes non-ascii characters

Bug #1229800 reported by Luis A. Garcia
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
New
Undecided
Luis A. Garcia

Bug Description

Some log messages are being lost due to a UnicodeDecodeError when the message being logged has ASCII characters in it.

To reproduce:
- Add the following message to cinder.mo:

msgid "HTTP exception thrown: %s"
msgstr "\u69cb\u30bd\u30c1 Exception HTTP \u69cb\u30bd\u30c1: %s"

- Restart cinder-api
- Do a GET /backups/999

The following will show up in the log:

2013-09-24 15:33:38.789 INFO cinder.api.openstack.wsgi [req-fc236f6d-0f8d-4d91-b34d-4af3a94707d5 c70aad8f6f344e37acf1b7725ab5f0c5 0e13a5c84947476ca2b8cdabbfa6767f] GET http://9.5.29.244:8776/v2/0e13a5c84947476ca2b8cdabbfa6767f/backups/blah
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 846, in emit
    msg = self.format(record)
  File "/opt/stack/cinder/cinder/openstack/common/log.py", line 552, in format
    return logging.StreamHandler.format(self, record)
  File "/usr/lib/python2.7/logging/__init__.py", line 723, in format
    return fmt.format(record)
  File "/opt/stack/cinder/cinder/openstack/common/log.py", line 516, in format
    return logging.Formatter.format(self, record)
  File "/usr/lib/python2.7/logging/__init__.py", line 464, in format
    record.message = record.getMessage()
  File "/usr/lib/python2.7/logging/__init__.py", line 328, in getMessage
    msg = msg % self.args
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
Logged from file wsgi.py, line 610
2013-09-24 15:33:38.891 INFO cinder.api.openstack.wsgi [req-fc236f6d-0f8d-4d91-b34d-4af3a94707d5 c70aad8f6f344e37acf1b7725ab5f0c5 0e13a5c84947476ca2b8cdabbfa6767f] http://9.5.29.244:8776/v2/0e13a5c84947476ca2b8cdabbfa6767f/backups/blah returned with HTTP 404

The "HTTP exception thrown" message will not be logged, instead the trace is.

Luis A. Garcia (luisg-8)
Changed in cinder:
assignee: nobody → Luis A. Garcia (luisg-8)
Revision history for this message
Mark McLoughlin (markmc) wrote :

Unless I'm misunderstanding, this is a duplicate of bug #1225099

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.