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?
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?