Florent Viard added the comment: Looking at the code, this issue makes sense
in logging/__init__.py (+738): def handle(self, record): """ Conditionally emit the specified logging record. Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission. """ rv = self.filter(record) if rv: self.acquire() try: self.emit(record) finally: self.release() return rv Than, in the "emit()" of whatever handler used, there is first: msg = self.format(record) In my opinion, a possible fix would be to change this code to something like: rv = self.filter(record) if rv: record.formatted_msg = self.format(record) self.acquire() try: self.emit(record) finally: self.release() return rv And then, change all the "emit()" of log handlers from: msg = self.format(record) to msg = record.processed_msg By not modifying the "msg" and "args" parameters of the record, all the code that would have reimplemented the standard log handler will still be working fine (even if they will still be at risk of encountering the deadlock) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25668> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com