Inconsistent behaviour when unicode args used for logging
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.log |
Fix Released
|
Undecided
|
Andrey Volkov |
Bug Description
When i used unicode args for log message, i got UnicodeDecodeError
If replace using oslo_log to logging from std python library, logging works fine
[1] Sample script, logging with oslo_log module http://
[2] Sample script, logging with Python logging module http://
[3] Sample file with unicode data http://
How to reproduce:
1 Save [3] as 'text.txt'
2 Run [1]
Expected result:
File log.txt contains
"жлдоыфв
фыжваофждыов"
Actual result:
Exception "UnicodeDecodeE
Logged from file oslo_test.py, line 9"
$ pip freeze|grep oslo.log
oslo.log==3.2.0
no longer affects: | nova |
Can be easily reproduced with: getLogger( __name_ _) .encode( 'utf8') )
from oslo_log import log as logging
LOG = logging.
LOG.info("Oslo Logging %s", u'\u2622'
The issue is related to implicit decoding of logging arguments due /github. com/openstack/ oslo.log/ blob/master/ oslo_log/ log.py# L129
_ensure_unicode for message:
https:/