﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26688	Inconsistent logging of 5xx and 4xx requests to django.request	Samir Shah	nobody	"The documentation for `django.request` says:

  Log messages related to the handling of requests. 5XX responses are raised as ERROR messages; 4XX responses are raised as WARNING messages.

The actual behaviour is not quite consistent with this:

- Only `404` and `500` responses are logged to `django.request` - not any other responses in the `4xx` and `5xx` range.

- `500` responses are only logged if they are the result of an uncaught exception. The logging happens in `django.core.handlers.base.handle_uncaught_exception`. If a view manually sets a `500` response somewhere, this isn't logged.

- The same was true of `404` responses (they were only logged if an uncaught `Http404` was raised), until the change made in ticket:26504 inadvertently altered this behaviour. After that change, all `404`s are logged regardless of how they are generated.

I would be happy to submit a patch that addresses this but would like some guidance on what the best solution is. My initial thoughts are:

- I think Django should log all `5xx` responses, regardless of how they were generated. This would mean refactoring the logic that does this logging.

- Either log all `4xx` responses or change the documentation to say that only `404`s are logged."	Uncategorized	new	HTTP handling	dev	Normal				Unreviewed	0	0	0	0	0	0
