django.db logger only works when DEBUG=True
|Reported by:||Malcolm Box||Owned by:||John Paulett|
|Cc:||john@…, Malcolm Box||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The default django.db logger only gets the SQL of queries written to it when DEBUG=True.
This limitation is not documented, leading users to expect their query logging to work.
Either the behaviour should be changed to always log (which would be preferred), or the documentation updated to reflect the DEBUG=True limitation.
Justification for always logging, even if DEBUG != True is that it is extremely useful to be able to turn on logging for DB queries on a production system without triggering all the other behaviours that DEBUG=True causes. With the current setup this is impossible. The developer already has control over suppressing the logging if it is unwanted, so nothing is lost by allowing query logging always.
Change History (7)
comment:1 Changed 6 years ago by
|Component:||Database layer (models, ORM) → Documentation|
|Triage Stage:||Unreviewed → Accepted|
comment:2 Changed 6 years ago by
|Owner:||changed from nobody to John Paulett|