This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Documentation falsely leads to believe that MemoryHandler can be used to wrap SMTPHandler to send multiple messages per email
Type: Stage:
Components: Library (Lib) Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: enrico, iritkatriel
Priority: normal Keywords:

Created on 2018-02-24 10:31 by enrico, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg312710 - (view) Author: Enrico Zini (enrico) Date: 2018-02-24 10:31
In the handlers documentation, MemoryHandler directly follows SMTPHandler. SMTPHandler does not document that it is sending an email per every logging invocation, but one can sort of guess it.

Right afterwards, there is the documentation of MemoryHandler, which seems to hint that one can use it to buffer up log lines and send all of them with SMTPHandler at flush time, by using it as a target.

What really happens when trying to do that, is that at flush time an email per buffered log line is sent instead.

It would have saved me significant time and frustration if I had found in SMTPHandler a note saynig that in order to buffer up all log messages and send them as a single email, one needs to reimplement BufferingHandler and all the email composition/sending logic, and the existing handlers provide no build-in facility for doing that.
msg391103 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-04-14 22:02
The documentation does talk about emit() operating on single records:

https://docs.python.org/3/library/logging.handlers.html#logging.handlers.BufferingHandler.emit

How would you make this clearer?
History
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77116
2021-04-14 22:02:39iritkatrielsetnosy: + iritkatriel

messages: + msg391103
versions: + Python 3.10, - Python 3.6
2018-02-24 10:31:19enricocreate