[Django] #26157: Unify database loggers to use same log record API

8 views
Skip to first unread message

Django

unread,
Jan 30, 2016, 12:33:44 AM1/30/16
to django-...@googlegroups.com
#26157: Unify database loggers to use same log record API
------------------------------------------------+-------------------------
Reporter: MarkusH | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Utilities | Version: master
Severity: Normal | Keywords: logging
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+-------------------------
While writing https://markusholtermann.eu/2016/01/syntax-highlighting-for-
djangos-sql-query-logging/ I noticed that the `django.db.backends` and
`django.db.backends.schema` loggers are not using the same "higher level"
API for the log records.

While the backends looger puts the query `duration`, `sql` and `params`
into the log record, the schema logger only passes the arguments for
string formatting.

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

Django

unread,
Jan 30, 2016, 7:27:56 AM1/30/16
to django-...@googlegroups.com
#26157: Unify database loggers to use same log record API
--------------------------------------+------------------------------------

Reporter: MarkusH | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: logging | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* component: Utilities => Migrations
* stage: Unreviewed => Accepted


Comment:

See also #25321 which suggests to document that the schema logger doesn't
include duration. Initially I thought you were proposing to add it, but I
think you just want to pass `sql` and `params` in the `logger.debug()`
`extra` kwarg. Is that all?

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

Django

unread,
Mar 8, 2016, 5:26:29 PM3/8/16
to django-...@googlegroups.com
#26157: Unify database loggers to use same log record API
--------------------------------------+------------------------------------
Reporter: MarkusH | Owner: akki
Type: Cleanup/optimization | Status: assigned

Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: logging | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by akki):

* owner: nobody => akki
* status: new => assigned
* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/6256

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

Django

unread,
Mar 9, 2016, 11:13:08 AM3/9/16
to django-...@googlegroups.com
#26157: Unify database loggers to use same log record API
--------------------------------------+------------------------------------
Reporter: MarkusH | Owner: akki
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: logging | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

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

* needs_docs: 0 => 1
* needs_tests: 0 => 1


Comment:

Release notes and tests are missing.

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

Django

unread,
Mar 14, 2016, 7:20:52 AM3/14/16
to django-...@googlegroups.com
#26157: Unify database loggers to use same log record API
--------------------------------------+------------------------------------
Reporter: MarkusH | Owner: MarkusH

Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: logging | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by MarkusH):

* owner: akki => MarkusH
* needs_docs: 1 => 0
* needs_tests: 1 => 0


Comment:

PR updated: https://github.com/django/django/pull/6289

Replying to [comment:3 timgraham]:


> Release notes and tests are missing.

I don't think this change is worth a mention in the release notes, tbh.

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

Django

unread,
Mar 14, 2016, 9:35:02 AM3/14/16
to django-...@googlegroups.com
#26157: Unify database loggers to use same log record API
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: | Status: assigned
Cleanup/optimization |

Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: logging | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


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

Django

unread,
Mar 15, 2016, 2:47:57 AM3/15/16
to django-...@googlegroups.com
#26157: Unify database loggers to use same log record API
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: | Status: closed

Cleanup/optimization |
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed

Keywords: logging | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Markus Holtermann <info@…>):

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


Comment:

In [changeset:"1cb65b8a77bd1b15f094b5857468c107784aad90" 1cb65b8a]:
{{{
#!CommitTicketReference repository=""
revision="1cb65b8a77bd1b15f094b5857468c107784aad90"
Fixed #26157 #25321 -- Added sql/params to extra context of schema logger

Thanks Akshesh Doshi for the initial patch and Tim Graham for the review
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26157#comment:6>

Reply all
Reply to author
Forward
0 new messages