django.db logger only works when DEBUG=True
|Reported by:||boxm||Owned by:||jpaulett|
|Cc:||john@…, boxm||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 5 years ago by russellm
- Component changed from Database layer (models, ORM) to Documentation
- milestone set to 1.3
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 5 years ago by jpaulett
- Cc john@… added
- Has patch set
- Owner changed from nobody to jpaulett