From db86e1d9e4a80b4cc86a510c768aa222ea68e54b Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 26 Apr 2018 14:04:16 +0200 Subject: [PATCH] [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 --- odoo/sql_db.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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