Skip to content

Commit

Permalink
logging_json: fix RecursionError
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sebalix authored and cyrilmanuel committed Mar 26, 2024
1 parent 0d0ca60 commit aa87497
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion logging_json/json_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit aa87497

Please sign in to comment.