summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2022-09-03 12:02:19 (GMT)
committerGitHub <noreply@github.com>2022-09-03 12:02:19 (GMT)
commite5823bf9b594937290ddd3c0f3e42f5c534f58d1 (patch)
tree8ad0b808b55572d731dc0679d4b5f1cc9ea35b45 /Doc
parent837ce6460d6554e9d7a847951ca5108ac6926ee5 (diff)
downloadcpython-e5823bf9b594937290ddd3c0f3e42f5c534f58d1.zip
cpython-e5823bf9b594937290ddd3c0f3e42f5c534f58d1.tar.gz
cpython-e5823bf9b594937290ddd3c0f3e42f5c534f58d1.tar.bz2
gh-89087: Update logging.QueueHandler documentation to clarify record… (GH-96527)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/logging.handlers.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst
index a012927..f3b26e7 100644
--- a/Doc/library/logging.handlers.rst
+++ b/Doc/library/logging.handlers.rst
@@ -1060,6 +1060,20 @@ possible, while any potentially slow operations (such as sending an email via
the record to a dict or JSON string, or send a modified copy
of the record while leaving the original intact.
+ .. note:: The base implementation formats the message with arguments, sets
+ the ``message`` and ``msg`` attributes to the formatted message and
+ sets the ``args`` and ``exc_text`` attributes to ``None`` to allow
+ pickling and to prevent further attempts at formatting. This means
+ that a handler on the :class:`QueueListener` side won't have the
+ information to do custom formatting, e.g. of exceptions. You may wish
+ to subclass ``QueueHandler`` and override this method to e.g. avoid
+ setting ``exc_text`` to ``None``. Note that the ``message`` / ``msg``
+ / ``args`` changes are related to ensuring the record is pickleable,
+ and you might or might not be able to avoid doing that depending on
+ whether your ``args`` are pickleable. (Note that you may have to
+ consider not only your own code but also code in any libraries that
+ you use.)
+
.. method:: enqueue(record)
Enqueues the record on the queue using ``put_nowait()``; you may