Problem with Custom Event Logs

S

Simon Johnson

I'm having trouble creating a custom event log.

Here's my Code:

static void Main(string[] args)
{
if (!EventLog.SourceExists("OnlineTonnages"))
EventLog.CreateEventSource("OnlineTonnages","EWC
Applications",Environment.MachineName);

EventLog ApplicationLog = new EventLog();
ApplicationLog.Source = "OnlineTonnages";
ApplicationLog.MachineName = Environment.MachineName;
ApplicationLog.Log = "EWC Applications";

ApplicationLog.WriteEntry("Test!");

}

It compiles and runs without error.. However, when I check the Event Viewer
to see if my log contains the test message I find that although the log has
been created and appears in the Event Viewer the Events don't go against the
log. Instead they appear in the application log with the following message:

"The description for Event ID ( 0 ) in Source ( OnlineTonnages ) cannot be
found. The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer. You may be
able to use the /AUXSOURCE= flag to retrieve this description; see Help and
Support for details. The following information is part of the event: Test!"

Is this a bug in the framework or something i'm doing incorrectly?

Simon.
 
A

Andy Gaskell

Ensure that
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\EWC
Applications\OnlineTonnages\EventMessageFile is pointing to
EventLogMessages.dll

On my system the path is
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\EventLogMessages.dll
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top