Using Insertion Strings and Message Files when writing to event lo

G

Guest

I am writing a .NET 1.1 C# windows service that writes to a dedicated event
log (not the application event log, but one that I created).
I want to make full use of all the fields in an event log record - category,
event ID, etc. I would like to make use of a message file as well.

I have created a message file DLL per the instructions at
http://msdn.microsoft.com/library/d...ry/en-us/wes/wes/sample_message_text_file.asp

However, since I am not using .NET 2.0 (not an option unfortunately), I
don't have any obvious way to tell the application or the event log to use
the message file. I have tried to manually create registry entries to
specify the MessageFile, CategoryFile, and Category count, but that doesn't
seem to work. How do I tell the system to use my message file?

Also, how do I use the WriteEntry method of System.Diagnostics.EventLog to
write to the event log so that I am not just writing a simple string message,
but am giving it the insertion strings to combine with the message from the
message file?

For example, I have created a message file with Category 1, and Message id
1023.
Say that Message 1023 is "Could not interpret value for Foo as a number.
Value that failed to parse was %1.".
When I try using
EventLog.WriteEntry(RegisteredLogSourceName,UninterpretableValueForFoo,severity,1023,1);
It records a value of -1 for the category, and doesn't seem to be merging
the text from the message file into the event log. I am on the same computer
that the event log is on.

In summary, how do I use .NET 1.1 to write an event log entry that uses
insertion strings?
 
C

Cor Ligthert [MVP]

Michael,

It is not my favorite sport, however if you ask your same question in one of
the dotnet languages newsgroups from the language you are using, than you
have much change that there are solutions by instance using application
program interfaces.

The groups are
microsoft.public.dotnet.languages.vb (or CSharp or VC)
or
microsoft.public.dotnet.jsharp

I hope you find your answer soon.

Cor

"Michael Blumenthal, MCSE, MCAD, MCDBA" <[email protected]>
schreef in bericht
news:[email protected]...
 

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