I "fixed" it by making a messages dll. See below for info on how I went about it. It looks complicated, but it's really not difficult.


Does anyone know a way to write to the event log without this error embedded in the log?

Here is the anonymized event log entry example:

Event Type: Information Event Source: MyAppName Event Category: None Event ID: 0 Date: 1/20/2009 Time: 1:28:16 AM User: N/A Computer: COMPUTER-NAME Description: The description for Event ID ( 0 ) in Source ( MyAppName ) cannot be f +ound. The local computer may not have the necessary registry informat +ion or message DLL files to display messages from a remote computer. +You may be able to use the /AUXSOURCE= flag to retrieve this descript +ion; see Help and Support for details. The following information is p +art of the event: This is a test log entry..

I've already found "Write to WIndows Event Log", but it doesn't really answer the question for me. I could use the WSH method, but I want my application's name to show up as the source, not "WSH". I can't use Win32::EventLog::Message because the version provided by Dave Roth doesn't support ActivePerl 5.10 and doesn't look like it ever will. Win32::EventLog::Message seems like the right answer, but too bad about the version problem.

Here is a sample of the code that I'm currently using to write the log:

use Win32::EventLog; my $eventlog = Win32::EventLog->new('MyAppName'); $eventlog->Report({ EventType => EVENTLOG_INFORMATION_TYPE, Strings => qq(This is a test log entry.), });

Even using the test case included with the module (at http://cpansearch.perl.org/src/JDB/Win32-EventLog-0.076/t/eventlog.t) fails in the same way.


Here's what I did to make it work for me:


While I ask a lot of Win32 questions, I hate Windows with a passion. That's the problem with writing a cross-platform program. I'm a Linux user myself. I wish more people were.
If you want to do evil, science provides the most powerful weapons to do evil; but equally, if you want to do good, science puts into your hands the most powerful tools to do so.
- Richard Dawkins

In reply to [fixed] Write to Win32 Event Log, get "/AUXSOURCE=" error by wilsond

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.