in reply to Write to WIndows Event Log

I have syntax-corrected your snippet (Missing semi-colon, comma, bogus NULL), and removed non-existant noise parameters.
use strict; writeeventlog(); ###################################### sub writeeventlog { use Win32::EventLog; my $eventLog = Win32::EventLog->new('MyProgram'); my %eventRecord = ( #'Source' => undef, #'Computer' => undef, 'Category' => 0, #NULL, 'EventID' => 0, 'EventType' => EVENTLOG_ERROR_TYPE, 'Strings' => 'Test.', 'Data' => 'Test.', ); $eventLog->Report(\%eventRecord); $eventLog->Close(); }
This writes entries to the event log just fine. The source does NOT haveto be registered in the Registry, but you can follow shonorio's advice.

The Eventviewer message is an attempt to decode the EventID, but since you do not have a message file or DLL associated with your app, you will need to ignore the Event viewers failed attempt to provide a "description" for your eventID.

     "Man cannot live by bread alone...
         He'd better have some goat cheese and wine to go with it!"

Replies are listed 'Best First'.
Re^2: Write to WIndows Event Log
by InfiniteSilence (Curate) on Sep 09, 2005 at 21:03 UTC
    you will need to ignore the Event viewers failed attempt to provide a "description" for your eventID...

    Without that information the entire message is of limited value. The cleaned up code does work though. Oh, I get it. The intended message is getting appended to the end of the weirdo system message that tells you that your app. is not registered. I would hate to be the guy explaining that to a System's Adminstrator...

    Celebrate Intellectual Diversity