[Django] #21484: sql logging incomplete

6 views
Skip to first unread message

Django

unread,
Nov 21, 2013, 7:24:31 PM11/21/13
to django-...@googlegroups.com
#21484: sql logging incomplete
----------------------------------------------+--------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
As discussed here https://docs.djangoproject.com/en/dev/topics/logging/
django supports logging of raw SQL queries. "For example, every SQL
statement executed by a request is logged at the DEBUG level to this
logger."

However, at least for mysql, this doesn't include initialization or
session management SQL queries.

Using wireshark I see a number of extra queries, that are never logged,
like:

{{{
SET NAMES utf8
set autocommit=0
SET SQL_AUTO_IS_NULL = 0
set autocommit=1
set autocommit=0
rollback
set autocommit=1
}}}

I assume "commit" is also on this list, however not part of this test.

Being able to see all the queries is important in order to debug obscure
problems.

Thanks

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

Django

unread,
Nov 24, 2013, 3:49:09 PM11/24/13
to django-...@googlegroups.com
#21484: sql logging incomplete
-------------------------------------+-------------------------------------

Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.6
(models, ORM) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

I think for most use cases this would just add more noise to the logs. You
can always turn on query logging at the database level if you need it.
I'll leave this open for a second opinion and perhaps we can make a
documentation update to note this limitation if we don't change the
behavior.

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

Django

unread,
Dec 2, 2013, 9:57:31 AM12/2/13
to django-...@googlegroups.com
#21484: sql logging incomplete
-------------------------------+------------------------------------

Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by aaugustin):

* component: Database layer (models, ORM) => Documentation
* stage: Unreviewed => Accepted


Comment:

In my opinion, the SQL logger aims at providing "application-level"
debugging. It answers the question "what queries does my application
emit?". The queries you're mentionning are "framework-level". If your
question is "what queries does my database receive?", like Tim, I suggest
turning on the database's query logging.

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

Django

unread,
Dec 25, 2013, 10:09:58 AM12/25/13
to django-...@googlegroups.com
#21484: Document that SQL logging does not include "framework level" queries
-------------------------------+------------------------------------

Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timo):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/21484#comment:3>

Django

unread,
Dec 31, 2013, 1:03:21 PM12/31/13
to django-...@googlegroups.com
#21484: Document that SQL logging does not include "framework level" queries
-------------------------------+------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"4d8d76e7a89858932b6f4f280a0ebf4cf94ab4b7"]:
{{{
#!CommitTicketReference repository=""
revision="4d8d76e7a89858932b6f4f280a0ebf4cf94ab4b7"
Fixed #21484 -- Documented that SQL logging does not include "framework
level" queries.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21484#comment:4>

Django

unread,
Dec 31, 2013, 1:03:48 PM12/31/13
to django-...@googlegroups.com
#21484: Document that SQL logging does not include "framework level" queries
-------------------------------+------------------------------------
Reporter: brian | Owner: nobody

Type: Bug | Status: closed
Component: Documentation | Version: 1.6
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"a228545026e30d3223b3fbb13a262b5e005101ae"]:
{{{
#!CommitTicketReference repository=""
revision="a228545026e30d3223b3fbb13a262b5e005101ae"
[1.6.x] Fixed #21484 -- Documented that SQL logging does not include
"framework level" queries.

Backport of 4d8d76e7a8 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21484#comment:5>

Reply all
Reply to author
Forward
0 new messages