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

Imre András Róbert beast at ludens.elte.hu
Tue Aug 10 12:46:45 CEST 2004


Hello Francois,

In fact, there are such generic IDs available in
e.g. win32evtlog.pyd, servicemanager.pyd.

Windows displays text for event IDs from a message
file specified under the following reg key, based
on the application name:

HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\

The EventMessageFile keys specify the dll or exe that
will be used to find constant text identified by the ID.
In this way the event log just contain references
instead of full text, which makes it smaller.

I suggest that your app installer should call
win32evtlogutil.AddSourceToRegistry (as this needs
to be done only once) while the uninstaller
should call RemoveSourceFromRegistry. If you
specify only the app name, win32evtlog.pyd
will be used to resolve IDs for that app, and
in here these general IDs are from 1 to 9.

There is no constant text for them, all of these
are specified as %1, so will just use the strings
passed to ReportEvent, thus no space will be saved.
(Each time the full text will be appended to the
log, not just a reference.)

If you'd like to save space, you should create your
own dll for this.


Regards,
  András


Monday, August 9, 2004, 9:33:03 PM, you wrote:

> Hi András,

> Thanks for directing me to the demo directory, found what I needed by
> using ReportEvent modules. Even if I get "Event ID ( 1 ) in Source (
> Application ) cannot be found" I can still post the info I needed.

> Would be nice if there were some kind of generic message ID that I could
> make use of, but for now this does the job.

> Thanks a million,

> Francois



More information about the Python-win32 mailing list