Opened 9 years ago

Closed 9 years ago

#26157 closed Cleanup/optimization (fixed)

Unify database loggers to use same log record API

Reported by: Markus Holtermann Owned by: Markus Holtermann
Component: Migrations Version: dev
Severity: Normal Keywords: logging
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (6)

comment:1 by Tim Graham, 9 years ago

Component: UtilitiesMigrations
Triage Stage: UnreviewedAccepted

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?

comment:2 by Akshesh Doshi, 9 years ago

Has patch: set
Owner: changed from nobody to Akshesh Doshi
Status: newassigned

comment:3 by Tim Graham, 9 years ago

Needs documentation: set
Needs tests: set

Release notes and tests are missing.

in reply to:  3 comment:4 by Markus Holtermann, 9 years ago

Needs documentation: unset
Needs tests: unset
Owner: changed from Akshesh Doshi to Markus Holtermann

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

Replying to timgraham:

Release notes and tests are missing.

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

comment:5 by Tim Graham, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Markus Holtermann <info@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 1cb65b8a:

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

Note: See TracTickets for help on using tickets.
Back to Top