Should I acquire lock for logging.Handler.flush()?
vinay_sajip at yahoo.co.uk
Tue Feb 21 21:52:14 CET 2012
On Feb 21, 7:23 am, Fayaz Yusuf Khan <fayaz.yusuf.k... at gmail.com>
> I'm writing a custom logging Handler that sends emails through AWS Simple
> Email Service using the boto library.
> As there's a quota cap on how many (200) emails I can send within 24hrs, I
> think I need to buffer my log messages from the emit() calls (Or is that a bad
> And I was reading the Handler documentation and was confused if I should call
> the acquire() and release() methods from within a flush() call.
> Fayaz Yusuf Khan
> Cloud developer and architect
> Dexetra SS, Bangalore, India
> < 1KViewDownload
If you are using SMTPHandler, calling flush() won't do anything.
You'll probably need to subclass the handler to implement rate
In the stdlib, only StreamHandler and its subclasses actually
implement flush(), which flushes I/O buffers to disk.
More information about the Python-list