Django doesn't log much at high verbosity levels

118 views
Skip to first unread message

Chris Wilson

unread,
Feb 3, 2014, 7:20:36 AM2/3/14
to Django Developers
Hi all,

I'd expect that Django would log something like:

* At INFO level, at least one line per request (similar to runserver
output)
* At DEBUG level, enough information to recreate the request

However, it doesn't appear to:

* There are only two logger.debug statements, both logging database SQL
commands
* There are no logger.info statements at all
* Turning on DEBUG logging for everything seems to log only SQL statements
and errors
* The django.request logger only seems to be used for errors and warnings

I'd like to add more info and debug logging to django.request as stated
above. Is that likely to be accepted?

Cheers, Chris.
--
Aptivate | http://www.aptivate.org | Phone: +44 1223 967 838
Citylife House, Sturton Street, Cambridge, CB1 2QF, UK

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.

Russell Keith-Magee

unread,
Feb 3, 2014, 7:32:15 PM2/3/14
to Django Developers
On Mon, Feb 3, 2014 at 8:20 PM, Chris Wilson <ch...@aptivate.org> wrote:
Hi all,

I'd expect that Django would log something like:

* At INFO level, at least one line per request (similar to runserver output)
* At DEBUG level, enough information to recreate the request

However, it doesn't appear to:

* There are only two logger.debug statements, both logging database SQL commands
* There are no logger.info statements at all
* Turning on DEBUG logging for everything seems to log only SQL statements and errors
* The django.request logger only seems to be used for errors and warnings

I'd like to add more info and debug logging to django.request as stated above. Is that likely to be accepted?

A definite "Maybe". :-)

For my money, this is probably something that is handled better by the web server. Apache, for example, logs one line per request, and can be configured to dump full GET and POST contents if you need that information. 

Aside from reproducing functionality available elsewhere, my concern would be performance. Adding a single logging call isn't much, but you're adding it into a critical path, so the impact could be large (especially if you're logging the full contents of POST and FILES data). 

So - I'm probably wavering between a +0 and -0, depending on the actual impact your proposed change has.

At the very least, it's worth opening a ticket -- even if the idea is ultimately rejected, a ticket allows us to archive the decision making process (since I doubt you're the first, or will be the last person to think of this idea).

Yours,
Russ Magee %-)

Chris Wilson

unread,
Feb 4, 2014, 5:19:12 AM2/4/14
to Django Developers
Hi Russell,

On Tue, 4 Feb 2014, Russell Keith-Magee wrote:

> A definite "Maybe". :-)
>
> For my money, this is probably something that is handled better by the web server. Apache, for example, logs one line per
> request, and can be configured to dump full GET and POST contents if you need that information. 
>
> Aside from reproducing functionality available elsewhere, my concern would be performance. Adding a single logging call isn't
> much, but you're adding it into a critical path, so the impact could be large (especially if you're logging the full contents of
> POST and FILES data). 
>
> So - I'm probably wavering between a +0 and -0, depending on the actual impact your proposed change has.
>
> At the very least, it's worth opening a ticket -- even if the idea is ultimately rejected, a ticket allows us to archive the
> decision making process (since I doubt you're the first, or will be the last person to think of this idea).

Thanks, I've created ticket https://code.djangoproject.com/ticket/21949,
with some more information on my reasons for proposing this.
Reply all
Reply to author
Forward
0 new messages