mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #30934 -- Included database alias in django.db.backends log messages.
This is useful when working with database routing as you want to know where each query is being executed. Co-authored-by: David Winterbottom <david.winterbottom@gmail.com>
This commit is contained in:
parent
313c3d1aa1
commit
fa35c8bdbc
5 changed files with 29 additions and 3 deletions
|
@ -178,6 +178,7 @@ Messages to this logger have the following extra context:
|
|||
* ``duration``: The time taken to execute the SQL statement.
|
||||
* ``sql``: The SQL statement that was executed.
|
||||
* ``params``: The parameters that were used in the SQL call.
|
||||
* ``alias``: The alias of the database used in the SQL call.
|
||||
|
||||
For performance reasons, SQL logging is only enabled when
|
||||
``settings.DEBUG`` is set to ``True``, regardless of the logging
|
||||
|
@ -188,6 +189,10 @@ This logging does not include framework-level initialization (e.g.
|
|||
``COMMIT``, and ``ROLLBACK``). Turn on query logging in your database if you
|
||||
wish to view all database queries.
|
||||
|
||||
.. versionchanged:: 4.0
|
||||
|
||||
The database ``alias`` was added to log messages.
|
||||
|
||||
.. _django-security-logger:
|
||||
|
||||
``django.security.*``
|
||||
|
|
|
@ -226,7 +226,8 @@ Internationalization
|
|||
Logging
|
||||
~~~~~~~
|
||||
|
||||
* ...
|
||||
* The alias of the database used in an SQL call is now passed as extra context
|
||||
along with each message to the :ref:`django-db-logger` logger.
|
||||
|
||||
Management Commands
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue