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
This commit is contained in:
Sébastien Alix
2024-01-19 13:30:12 +01:00
parent 0d0ca60710
commit 309490a280
+1 -1
View File
@@ -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)