Reading Custom Log

G

Guest

I have created a custom log for my apps to write to. Writing to the log seems
to be no problem, it's when I go to read it I get unexpected results. I have
an application that reads the log and displays it's contents in a grid, and
it also receives event notification from the log when it's updated. When the
event fires I get exactly the text that was logged in exactly the way I
logged, but when I read the entries from the log, or view them from Event
Viewer, I get extra text that's similar to "The description for Event ID ( 0
) in Source ( ReconRptBuild ) 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" .... after this I get my actual event text.

How can I write events to the log that will not generate this extra text?
 
G

Guest

I assume that you are using the .NET EventLog class and Windows 2000 or above.

When you create a custom event log and event source, it is done by adding a
registry entry (.NET will do this for you the first time you write an event
to the log).

The registry key that is created is as follows:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\<event log
name>\<event source name>

Under this key, a value is also created (details follow):
EventMessageFile="C:\WINDOWS\Microsoft.NET\Framework\<clr
version>\EventLogMessages.dll"

It is this EventLogMessages.dll file that allows Event Viewer to display the
messages in the form that you are expecting, so I would begin by checking for
the presence of the registry entry and file.

Hope this helps.
 
G

Guest

The setting is as follows, and I have verified the existance of the dll.

C:\WINNT\Microsoft.NET\Framework\v1.1.4322\EventLogMessages.dll
 
G

Guest

So are you saying that, when your application receives notification via the
EntryWritten event, the Message property is correct but, if your application
then were to read the same entry, the Message would come back with the
incorrectly formatted string?

If so, that seems very strange. Presumably none of your messages appear
correctly in Event Viewer? Is this all occurring while you are logged on as
the same user?
 
G

Guest

refer to new posting with today's date.

The message does not appear correctly in the event view
the Message does not appear correctly in my custom viewer, but it's
different thn event viewer
The message is Correct only when received "EntryWritten" Event

This occurs on 2 machines, 1 with XP SP2 (developement), and the other with
Win2k SP4.
 

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