New submission from Paul Cyr <pyt...@paulcyr.ca>:

>From the docs:

https://docs.python.org/3.6/library/logging.html#logging.Formatter

"class logging.Formatter(fmt=None, datefmt=None, style='%') ...
If no datefmt is specified, the ISO8601 date format is used."

However, the output from the formatter when no datefmt is specified is not an 
ISO8601 date. It is also a datetime format, not a date format.

Example output: 2018-05-01 19:04:31,505

Not being an ISO member, I don't have access to the official source for the 
specification but, trusting other sources, it appears that the output is 
missing the required 'T' delimiter between the date and time, and it is also 
missing the timezone. A compliant output would be:

2018-05-01T19:04:31,505Z

The current output appears to actually be closer to RFC 3339, as that standards 
allows for a space instead of the 'T' delimiter, but RFC 3339 still requires a 
timezone.

Either the documentation should be updated to state that the format used is an 
RFC 3339 datetime but without a timezone, or the format should comply with the 
standard specified in the documentation.

----------
components: Library (Lib)
messages: 316012
nosy: paulc
priority: normal
severity: normal
status: open
title: logging.Formatter does not default to ISO8601 date format
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33400>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to