Issue1524081
Created on 2006-07-17 19:33 by misa, last changed 2006-07-20 23:27 by vinay.sajip.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
logging-broken.py
|
misa,
2006-07-17 19:33
|
Simple test script to show the problem. Call it after setting LANG=tr_TR.UTF-8 |
|
|
|
msg29194 - (view) |
Author: Mihai Ibanescu (misa) |
Date: 2006-07-17 19:33 |
|
This affectes b2 and python 2.4 too.
Initially reported here:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=198971
Looking at logging/handlers.py:
Line 635:
self.encodePriority(self.facility,
string.lower(record.levelname)), msg)
Line 611 in encodePriority:
priority = self.priority_names[priority]
priority_names is declared on line 527:
priority_names = {
"alert": LOG_ALERT,
"crit": LOG_CRIT,
...
"info": LOG_INFO,
...
Now, if one initializes the locale (i.e.
locale.setlocale(locale.LC_ALL, "")
and then tries to use the logging module, it will fail
with an exception looking kinda like:
File "/usr/lib64/python2.4/logging/handlers.py", line
627, in encodePriority
priority = self.priority_names[priority]
KeyError: 'Info'
if they choose LANG=tr_TR.UTF-8
This happens because in that particular locale,
"INFO".lower() != "info"
|
|
msg29195 - (view) |
Author: Vinay Sajip (vinay.sajip) |
Date: 2006-07-20 23:27 |
|
Logged In: YES
user_id=308438
Fixed by using a dict to map logging level names to syslog
priority level names. This also facilitates usage when
custom logging levels are present.
Fix is checked into Subversion.
|
|
| Date |
User |
Action |
Args |
| 2006-07-17 19:33:18 | misa | create | |
|