classification
Title: time format in logging is wrong
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, vinay.sajip, yves@zioup.com
Priority: normal Keywords:

Created on 2011-09-23 15:21 by yves@zioup.com, last changed 2011-09-23 16:00 by vinay.sajip. This issue is now closed.

Messages (2)
msg144447 - (view) Author: Yves Dorfsman (yves@zioup.com) Date: 2011-09-23 15:21
The basic time format in the logging module uses a comma instead of a dot to separate the seconds from the tenth of seconds:

    import logging
    logging.basicConfig(format='%(asctime)s %(message)s')
    logging.warning('hello')

2011-09-23 09:08:53,739 hello



Using a dot seems to be more accepted, see:

ls -l --full-time

Java's default dates

python's datetime.datetime.isoformat( datetime.datetime.now() )
msg144448 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-09-23 16:00
Logging's date/time representation is supposed to conform to ISO 8601.

From ISO Standard 8601 (Third Edition, dated 2004-12-01):

4.2.2.4 Representations with decimal fraction

If necessary for a particular application a decimal fraction of hour, minute or second may be included. If a decimal fraction is included, lower order time elements (if any) shall be omitted and the decimal fraction shall be divided from the integer part by the decimal sign specified in ISO 31-0, i.e. the comma [,] or full stop [.]. Of
these, the comma is the preferred sign.
History
Date User Action Args
2011-09-23 16:00:23vinay.sajipsetstatus: open -> closed
resolution: not a bug
messages: + msg144448
2011-09-23 15:33:42ezio.melottisetnosy: + vinay.sajip, belopolsky
2011-09-23 15:21:37yves@zioup.comcreate