Suggestion to change the Logger date format to ISO 8601

33 views
Skip to first unread message

Leon Albrecht

unread,
Dec 16, 2019, 6:06:58 PM12/16/19
to Django developers (Contributions to Django itself)
At the moment Django is using "DD/MMM/YYYY hh:mm:ss", but since 1988 there exists an ISO to format dates like this: "YYY-DD-MM hh:mm:ss"

this is not a majot change and i've searched for to do it myself but according to the python logger libary this format is already in use, but Django apperantly changes it, somewhere I could not find it, to the beforementioned format.

Adam Johnson

unread,
Dec 16, 2019, 6:58:02 PM12/16/19
to django-d...@googlegroups.com
Hi

I think the change you're referring to is in runserver: https://github.com/django/django/blob/ff00a053478fee06bdfb4206c6d4e079e98640ff/django/core/servers/basehttp.py#L132 . Django uses a function from the standard library wsgiref simple server here to generate server_time which is then shown in the log format. Indeed it doesn't seem to allow configuring it at current.

I imagine there's a way to stop using the log_date_time_string() function there if you want, however I am not sure about changing the default. Many sites end up using runserver in production (despite it being insecure) and it's likely there are scripts out there to parse the logs as they are.

Thanks,

Adam

On Mon, 16 Dec 2019 at 17:25, Leon Albrecht <leon2...@gmail.com> wrote:
At the moment Django is using "DD/MMM/YYYY hh:mm:ss", but since 1988 there exists an ISO to format dates like this: "YYY-DD-MM hh:mm:ss"

this is not a majot change and i've searched for to do it myself but according to the python logger libary this format is already in use, but Django apperantly changes it, somewhere I could not find it, to the beforementioned format.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9536ce2f-e864-4231-99b5-66a7fde9f77c%40googlegroups.com.


--
Adam
Reply all
Reply to author
Forward
0 new messages