Opened 4 years ago

Closed 4 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: master
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 Changed 4 years ago by Tim Graham

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 Changed 4 years ago by Akshesh Doshi

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

comment:3 Changed 4 years ago by Tim Graham

Needs documentation: set
Needs tests: set

Release notes and tests are missing.

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

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 Changed 4 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:6 Changed 4 years ago by Markus Holtermann <info@…>

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