[python-win32] Monitoring the Event Log

David Rushby davidrushby at yahoo.com
Wed Nov 17 22:49:46 CET 2004


--- "Jan Van Uytven (Wyvern)" <wyvernlist at crm3.com> wrote:
> I found out I can capture the events as they're being 
> generated using wmi...
> ...
> I can see a problem with this approach - Windows generates 
> events frequently, and I wouldn't want to miss a relevant 
> event while the service is busy sending an e-mail. I think
> threading might be useful here - do the e-mailing in a 
> separate thread while continuing to examine events. 

The easiest, least error-prone way to do this is to use Python's Queue
module (http://docs.python.org/lib/module-Queue.html ), which was
designed for situations like this one.

Have one thread listen via WMI for Event Log entries and insert the
resulting entries with Queue.put, while another thread retrieves the
entries with Queue.get and e-mails them.  This pattern is known as producer/consumer.


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 



More information about the Python-win32 mailing list