[Django] #33897: django.request log for all requests

7 views
Skip to first unread message

Django

unread,
Aug 5, 2022, 5:39:19 AM8/5/22
to django-...@googlegroups.com
#33897: django.request log for all requests
---------------------------------------+-------------------------
Reporter: chemeng | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 4.0
Severity: Normal | Keywords: logging
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+-------------------------
What's the rationale behind only logging responses with `django.request`
if status code is >= 400? Do you think we could make this a setting that a
user can configure?

For me it would be nice if I could use the same logger for all my requests
coming from gunicorn but now I'm getting only 4XX, 5XX from django and all
requests within gunicorn. I would ideally like to disable gunicorn logging
and just capture all requests coming from django directly.

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

Django

unread,
Aug 5, 2022, 5:40:02 AM8/5/22
to django-...@googlegroups.com
#33897: django.request log for all requests
-----------------------------+--------------------------------------

Reporter: chemeng | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 4.0
Severity: Normal | Resolution:

Keywords: logging | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Description changed by chemeng:

Old description:

> What's the rationale behind only logging responses with `django.request`
> if status code is >= 400? Do you think we could make this a setting that
> a user can configure?
>
> For me it would be nice if I could use the same logger for all my
> requests coming from gunicorn but now I'm getting only 4XX, 5XX from
> django and all requests within gunicorn. I would ideally like to disable
> gunicorn logging and just capture all requests coming from django
> directly.

New description:

What's the rationale behind only logging responses with `django.request`
if status code is >= 400? Do you think we could make this a setting that a
user can configure?

For me it would be nice if I could use the same logger for all my requests
coming from gunicorn but now I'm getting only 4XX, 5XX from django and all

requests within gunicorn (ending up with duplicate logs for 4XX & 5XX). I


would ideally like to disable gunicorn logging and just capture all
requests coming from django directly.

--

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

Django

unread,
Aug 5, 2022, 6:32:25 AM8/5/22
to django-...@googlegroups.com
#33897: django.request log for all requests
-------------------------------+--------------------------------------
Reporter: Tim Ioannidis | Owner: nobody
Type: New feature | Status: closed
Component: HTTP handling | Version: 4.0
Severity: Normal | Resolution: wontfix

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

* status: new => closed
* resolution: => wontfix
* component: Utilities => HTTP handling


Comment:

> What's the rationale behind only logging responses with `django.request`
if status code is >= 400?

As far as I'm aware web server logs are appropriate place for logging all
responses. It's not something that must be included in Django itself (see
also #12012 and LoggingProposal).

> Do you think we could make this a setting that a user can configure?

Creating a new setting is always controversial because we already have
plenty of them. Moreover, you can find many 3rd-party packages (e.g.
`django-request-logging`, `django-request`) that will help you to achieve
this. You can also add a custom middleware that will log all responses in
the `django.request` logger.

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

Reply all
Reply to author
Forward
0 new messages