Merge pull request #486 from adhoc-dev/18.0-current-thread

[FIX] logging_json: deprecated method currentthread
This commit is contained in:
Florent Xicluna
2025-05-06 10:46:46 +02:00
committed by GitHub
co-authored by GitHub
+1 -1
View File
@@ -26,7 +26,7 @@ def is_true(strval):
class OdooJsonFormatter(jsonlogger.JsonFormatter): class OdooJsonFormatter(jsonlogger.JsonFormatter):
def add_fields(self, log_record, record, message_dict): def add_fields(self, log_record, record, message_dict):
record.pid = os.getpid() 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.request_id = getattr(threading.current_thread(), "request_uuid", None)
record.uid = getattr(threading.current_thread(), "uid", None) record.uid = getattr(threading.current_thread(), "uid", None)
_super = super() _super = super()