summaryrefslogtreecommitdiff
path: root/django/db/backends/utils.py
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2021-07-02 14:36:53 +0100
committerGitHub <noreply@github.com>2021-07-02 15:36:53 +0200
commitfa35c8bdbc6aca65d94d6280fa463d5bc7baa5c0 (patch)
treefd32615a8397e8c5068eb45a0c7e43ed1eb44795 /django/db/backends/utils.py
parent313c3d1aa14d80922003f841c257ec4e153f8653 (diff)
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>
Diffstat (limited to 'django/db/backends/utils.py')
-rw-r--r--django/db/backends/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py
index 45c03ba3e9..c342cf79b5 100644
--- a/django/db/backends/utils.py
+++ b/django/db/backends/utils.py
@@ -121,11 +121,12 @@ class CursorDebugWrapper(CursorWrapper):
'time': '%.3f' % duration,
})
logger.debug(
- '(%.3f) %s; args=%s',
+ '(%.3f) %s; args=%s; alias=%s',
duration,
sql,
params,
- extra={'duration': duration, 'sql': sql, 'params': params},
+ self.db.alias,
+ extra={'duration': duration, 'sql': sql, 'params': params, 'alias': self.db.alias},
)