From 309490a28083d1b44cd15494fe52c23eac5e090c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Fri, 19 Jan 2024 13:30:12 +0100 Subject: [PATCH] logging_json: fix RecursionError Since Python 3.10, the use of 'threading.currentThread()' is deprecated and generates a warning, and generating this warning log was in turn entering in the `logging_json` mechanism, triggering an exception: RecursionError: maximum recursion depth exceeded while calling a Python object --- logging_json/json_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging_json/json_log.py b/logging_json/json_log.py index cc7efcb4..91cf0bea 100644 --- a/logging_json/json_log.py +++ b/logging_json/json_log.py @@ -26,7 +26,7 @@ def is_true(strval): class OdooJsonFormatter(jsonlogger.JsonFormatter): def add_fields(self, log_record, record, message_dict): record.pid = os.getpid() - record.dbname = getattr(threading.currentThread(), "dbname", "?") + record.dbname = getattr(threading.current_thread(), "dbname", "?") record.request_id = getattr(threading.current_thread(), "request_uuid", None) record.uid = getattr(threading.current_thread(), "uid", None) _super = super(OdooJsonFormatter, self)