Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20673

Re: Should I acquire lock for logging.Handler.flush()?

From Fayaz Yusuf Khan <fayaz.yusuf.khan@gmail.com>
Subject Re: Should I acquire lock for logging.Handler.flush()?
Date 2012-02-22 10:14 +0530
References <mailman.26.1329809252.3037.python-list@python.org> <0e8f8dd1-ffe7-42fd-bc95-82ea60358f04@n12g2000yqb.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.36.1329885907.3037.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tuesday 21 Feb 2012 12:52:14 PM Vinay Sajip wrote:
> If you are using SMTPHandler, calling flush() won't do anything.
> You'll probably need to subclass the handler to implement rate
> limiting.
Oh, no! I'm writing my own handler.
https://github.com/fayazkhan/ses_handler/blob/master/ses_handler.py
Now I understand from here 
http://docs.python.org/library/logging.html#handler-objects
that emit() calls are wrapped acquire() and release() in the handle() method.

Anyway, I read the source and found many interesting things that ought to be 
mentioned in the docs.
Such as flush() should be called from close() whenever it's implemented. 
(FileHandler.close() is doing it)
And how come close()/flush() isn't being called from inside a lock?
(Handler.close() calls the module level _acquireLock() and _releaseLock()s but 
nothing about the instance level acquire() or release())
Or is it being locked from somewhere else?
-- 
Fayaz Yusuf Khan
Cloud developer and architect
Dexetra SS, Bangalore, India
fayaz.yusuf.khan_AT_gmail_DOT_com
fayaz_AT_dexetra_DOT_com
+91-9746-830-823

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Should I acquire lock for logging.Handler.flush()? Fayaz Yusuf Khan <fayaz.yusuf.khan@gmail.com> - 2012-02-21 12:53 +0530
  Re: Should I acquire lock for logging.Handler.flush()? Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-02-21 12:52 -0800
    Re: Should I acquire lock for logging.Handler.flush()? Fayaz Yusuf Khan <fayaz.yusuf.khan@gmail.com> - 2012-02-22 10:14 +0530
      Re: Should I acquire lock for logging.Handler.flush()? Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-02-23 08:23 -0800
        Re: Should I acquire lock for logging.Handler.flush()? Fayaz Yusuf Khan <fayaz.yusuf.khan@gmail.com> - 2012-02-23 23:25 +0530
          Re: Should I acquire lock for logging.Handler.flush()? Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-02-23 11:08 -0800
          Re: Should I acquire lock for logging.Handler.flush()? Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-02-23 12:06 -0800

csiph-web