.Net EventLog object

  • Thread starter Thread starter Aleksandr Ignatov
  • Start date Start date
A

Aleksandr Ignatov

I am using System.Diagnostics.EventLog object and it looks.
like there is no way that I can't pass array of the string for
parameters in given message from custome message files as it was posible
to do in standart SDK function

BOOL ReportEvent(
HANDLE hEventLog,
WORD wType,
WORD wCategory,
DWORD dwEventID,
PSID lpUserSid,
WORD wNumStrings, // Number of strings in the array
DWORD dwDataSize,
LPCTSTR* lpStrings, // Pointer to a buffer containing an
array of // null-terminated strings that are merged into // the
message from the message file
LPVOID lpRawData
);

Correct me if I am wrong, but wouldn't be reasonable to
have a function WriteEntry that will take String[]
as a parameter.

Thank's
Aleksandr
 
The implementation of the EventLog class is extremely limited. It is far
from fully functional, and doesn't even work correctly when you setup a
message dll.

I've found that when you want the ability to save space in the event log by
using a message DLL that it is better to just use P/Invoke and do the
logging with ReportEvent. That's the way I have been doing it in my apps;
they generally do have a message DLL for event logging and log to a custom
event log file as well.

BTW, you'll find other issues with it as well. For example, when using it to
READ a log it will not mask the high order bits like the "customer bit" from
the message compiler and other high bits (look at some Norton Anti-Virus
events in both the viewer and with the EventLog class).

Jerry
 
Back
Top