classification
Title: default logging time string is not localized
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, pitrou, sdague, vinay.sajip
Priority: normal Keywords:

Created on 2014-09-25 10:42 by sdague, last changed 2014-10-01 11:57 by vinay.sajip. This issue is now closed.

Messages (4)
msg227521 - (view) Author: Sean Dague (sdague) Date: 2014-09-25 10:42
The default time string is not localized for using locale specific formatting, but is instead hardcoded to a ','. 

https://hg.python.org/cpython/file/c87e00a6258d/Lib/logging/__init__.py#l483 demonstrates this.

Instead I think we should set that to the value of: locale.localeconv()['decimal_point']

While this clearly a very minor issue, I stare at enough logging output data that falls back to default formats (due to testing environments) that would love for this to be locale aware.
msg228068 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-10-01 10:51
I'm a bit surprised here, since the comma is not the default (US) decimal point.
msg228069 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-10-01 11:49
It's not so surprising, since the string before the milliseconds part is a strftime() result, not a whole number.  The decimal point need not necessarily be used for this.

Just like the rest of the default time format, it is probably best for the millisecond part to be locale independent unless chosen to be locale aware by the programmer.

Using the comma is apparently common among loggers. I've seen it in logs generated by log4j and log4cpp as well.
msg228070 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-10-01 11:57
ISO 8601 governs the format used. From the Wikipedia article on the same:

"A decimal mark, either a comma or a dot (without any preference as stated in resolution 10 of the 22nd General Conference CGPM in 2003, but with a preference for a comma according to ISO 8601:2004) is used as a separator between the time element and its fraction."
History
Date User Action Args
2014-10-01 11:57:22vinay.sajipsetstatus: open -> closed
resolution: not a bug
messages: + msg228070
2014-10-01 11:49:56georg.brandlsetnosy: + georg.brandl
messages: + msg228069
2014-10-01 10:51:39pitrousetnosy: + pitrou
messages: + msg228068
2014-09-25 18:46:00ned.deilysetnosy: + vinay.sajip
2014-09-25 10:42:32sdaguecreate