summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2018-04-26 14:04:16 +0200
committerNicolas Lempereur <nle@odoo.com>2018-04-26 16:54:32 +0200
commitdb86e1d9e4a80b4cc86a510c768aa222ea68e54b (patch)
tree2bc514c85bfdd31b98d3e31cd7a952160e45f762
parentb2ad88e38de44692661baf08b127b7f5b1782e54 (diff)
[FIX] sql_db: log-level debug_sql log parameters
Since 1a58e108 (on 10.0 and over) parameters are no longer present when logging sql queries. This removes some of the usefulness of the feature, and this commit adds them back. Since mogrify returns a byte string in the database encoding, we decode it using the corresponding python encoding. opw-1839241 closes #24446
-rw-r--r--odoo/sql_db.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/sql_db.py b/odoo/sql_db.py
index 8414dcf3dcc..6d96fb8aa74 100644
--- a/odoo/sql_db.py
+++ b/odoo/sql_db.py
@@ -226,7 +226,8 @@ class Cursor(object):
if self.sql_log:
now = time.time()
- _logger.debug("query: %s", query)
+ encoding = psycopg2.extensions.encodings[self.connection.encoding]
+ _logger.debug("query: %s", self._obj.mogrify(query, params).decode(encoding, 'replace'))
try:
params = params or None