From fa35c8bdbc6aca65d94d6280fa463d5bc7baa5c0 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Fri, 2 Jul 2021 14:36:53 +0100 Subject: 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 --- docs/ref/logging.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/logging.txt b/docs/ref/logging.txt index e60583c41c..8c682dfceb 100644 --- a/docs/ref/logging.txt +++ b/docs/ref/logging.txt @@ -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.*`` -- cgit v1.3