[Django] #29329: Inconsistent datetime logging from runserver.

20 views
Skip to first unread message

Django

unread,
Apr 16, 2018, 8:58:31 AM4/16/18
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
----------------------------------------------+------------------------
Reporter: Sjoerd Job Postmus | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------------+------------------------
In Django 1.11 and higher, the runserver logging can sometimes be
inconsistent.

{{{
[16/Apr/2018 13:32:35] "GET /some/local/url HTTP/1.1" 200 7927
[2018-04-16 13:32:35,745] - Broken pipe from ('127.0.0.1', 57570)
}}}

This is because logging from `WSGIRequestHandler` uses `server_time` as
calculated using `BaseHTTPServer.log_date_time_string`. On the other hand,
`WSGIServer` uses logging without providing a `server_time`. This gets
"fixed" in `ServerFormatter.format` using `self.formatTime(record,
self.datefmt)`, which uses a completely different format.

Currently we make this at least consistent by providing the `datefmt`
parameter when constructing the logger, but it would be better if they
were coded to be in sync (and configurable?).

(Looking into it further, it looks like we should be using `%(asctime)s`
instead of `%(server_time)s`, but would be good if that were the suggested
default. In https://docs.djangoproject.com/en/2.0/releases/1.10
/#runserver-output-goes-through-logging we see `%(server_time)s`.)

--
Ticket URL: <https://code.djangoproject.com/ticket/29329>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 16, 2018, 10:31:48 AM4/16/18
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
-------------------------------------+-------------------------------------

Reporter: Sjoerd Job Postmus | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* component: Uncategorized => Core (Other)
* type: Uncategorized => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/29329#comment:1>

Django

unread,
Apr 16, 2018, 12:56:42 PM4/16/18
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
--------------------------------------+------------------------------------

Reporter: Sjoerd Job Postmus | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* type: Uncategorized => Cleanup/optimization


* component: Uncategorized => Core (Other)

* stage: Unreviewed => Accepted

Django

unread,
Apr 28, 2018, 2:45:27 PM4/28/18
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
-------------------------------------+-------------------------------------
Reporter: Sjoerd Job Postmus | Owner: Srinivas
Type: | Reddy Thatiparthy
Cleanup/optimization | Status: assigned

Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Srinivas Reddy Thatiparthy):

* owner: nobody => Srinivas Reddy Thatiparthy
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29329#comment:2>

Django

unread,
Mar 1, 2020, 4:00:44 PM3/1/20
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
-------------------------------------+-------------------------------------
Reporter: Sjoerd Job Postmus | Owner: Hasan
Type: | Ramezani

Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: Srinivas Reddy Thatiparthy => Hasan Ramezani
* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29329#comment:3>

Django

unread,
Mar 12, 2020, 10:28:01 AM3/12/20
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
-------------------------------------+-------------------------------------
Reporter: Sjoerd Job Postmus | Owner: Hasan
Type: | Ramezani
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29329#comment:4>

Django

unread,
Mar 12, 2020, 7:26:14 PM3/12/20
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
-------------------------------------+-------------------------------------
Reporter: Sjoerd Job Postmus | Owner: Hasan
Type: | Ramezani
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29329#comment:5>

Django

unread,
Apr 16, 2020, 7:21:37 AM4/16/20
to django-...@googlegroups.com
#29329: Inconsistent datetime logging from runserver.
-------------------------------------+-------------------------------------
Reporter: Sjoerd Job Postmus | Owner: Hasan
Type: | Ramezani
Cleanup/optimization | Status: closed

Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"7b31ba541f1dfb3a8e782b1319c25a24f9d86f8a" 7b31ba54]:
{{{
#!CommitTicketReference repository=""
revision="7b31ba541f1dfb3a8e782b1319c25a24f9d86f8a"
Fixed #29329 -- Made datetime logging from runserver more consistent.

Setting default_msec_format=None will make it the same, unfortunately
it's not supported by Python, see https://bugs.python.org/issue40300.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29329#comment:6>

Reply all
Reply to author
Forward
0 new messages