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 authored and cyrilmanuel committed 2024-03-27 13:19:22 +01:00
1 parent 99e6785179
commit f34dc6be27
1 file changed
+1 -1
+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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.