[python-win32] Writing event to event log...

Imre András Róbert beast at ludens.elte.hu
Mon Aug 9 03:39:34 CEST 2004


Hello fmml,

The ReportEvent method is a decent one to try,
you may find in in win32evtlogutil.py.

The servicemanager module contains some simple
methods for this as well:

LogMsg
  Write an specific message to the log.

LogInfoMsg
  Write an informational message to the log.

LogErrorMsg
  Write an error message to the log.

LogWarningMsg
  Logs a generic warning message to the event log.


Supposed you installed pywin32, you could have a look at
these in use in demos under <python home>\Lib\site-packages\win32\Demos
directory. Especially eventLogDemo.py and service\pipeTestService.py.

That's a good starting point. Should you need to define your own
categories and event IDs, things will get harder. If still interested,
you may find an ongoing discussion on this topic in the following thread
here: [Windows service features and Python]


Hope this helps,
  András


Sunday, August 8, 2004, 2:24:19 PM, you wrote:

> Hi all,

> I am looking for a way to write to the windows event log, abritrary
> events. For example, I have written a script that check the presense of
> certain processes, if one of them is not present, I want to write an
> event.

> How can I do that, can someone show me an example...

> Thanks in advance,

> Francois
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the Python-win32 mailing list