[New-bugs-announce] [issue35726] QueueHandler formating affects other handlers

David Ruggles report at bugs.python.org
Sat Jan 12 08:55:13 EST 2019


New submission from David Ruggles <thedavidfactor at gmail.com>:

ISSUE: if you add a formatter to QueueHandler any subsequently added handlers will get the formatting added to QueueHandler

CAUSE: as best as I can tell, the code here:
https://github.com/python/cpython/blob/d586ccb04f79863c819b212ec5b9d873964078e4/Lib/logging/handlers.py#L1380
is modifying the record object so when it get passed to the next handler here:
https://github.com/python/cpython/blob/d586ccb04f79863c819b212ec5b9d873964078e4/Lib/logging/__init__.py#L1656
it includes the formatting applied by the QueueHandler's formatter.

I worked around this issue by moving my formatter from the QueueHandler to the QueueListener

I've attached a simple example of the issue

NOTE: I marked this as Python 3.7 because that's what I'm using, but I looked at github and the code is in master so I assume this affects 3.8 too.

----------
components: Library (Lib)
files: queuehandler_bug.py
messages: 333526
nosy: David Ruggles
priority: normal
severity: normal
status: open
title: QueueHandler formating affects other handlers
versions: Python 3.7
Added file: https://bugs.python.org/file48044/queuehandler_bug.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35726>
_______________________________________


More information about the New-bugs-announce mailing list