Remove deprecated %z formatting from the default LOG_DATEFORMAT #1278
Conversation
@curita it is I second your question from #1270 (comment) - it is not clear why is |
Aha, it seems '%z' is not officially supported in Python 2.x - it is even not in a list of possible options in 2.x docs. It is added to the list in 3.x docs, but I'm not sure it is supported even in 3.x. I think it is fine to remove it. |
Just updated the issue description too :) I misread '%Z' as '%z', but it does seem is not officially supported. |
Remove deprecated %z formatting from the default LOG_DATEFORMAT
The problem with this change is that without timezone info timestamps in logs become ambiguous. I wonder if it is possible to either force UTC time in logs or somehow bring timezones back. |
If I understand correctly we can use |
Closes #1270
Not sure if the timezone is going to be missed from the logs (twisted logging had it) and I'm not entirely sure why windows is expanding it to contain non-ascii chars as reported in the issue, but '%z' time formatting is deprecated as stated here:
https://docs.python.org/2/library/time.html#id2[EDIT: I misread it, but is not listed in https://docs.python.org/2/library/time.html#time.strftime so it seems it's not officially supported], so it's probably safer to just remove it. '%Y-%m-%d %H:%M:%S' is the default datefmt for 'asctime' if there isn't one specified as well.Note that this change just aims to have a sane default, since this is really a python logging issue. Users could still set LOG_DATEFORMAT to whatever they want, but they'll have to deal with the issues the python logging could arise.