I need to write an application to grab event log for System/Applications. The other requirement is that I need to read event log every minute or so to grab the new event logs since I read last time.
Currently I am considering to use C# to implement instead of C++.
With that I read several webpages and if I understand correctly, I can use either WMI or EventLog class to read event log.
It seems to me that I can be notified when the new event log is added using EventLog class but I was not sure that is better than using WMI.
If my understanding is correct, I would like to know which way I should take?
Please give me some advice. Thanks.
Best Answer
I know this is long after the original post, but I hope this is usefule to future searchers like myself who found the EventLog class too slow. Here is some code to demonstrate searching for the most recent System startup events:
If you only want the most recent entry, this code took 0.28 seconds on my machine, compared with 7.11 seconds using EventLog class in place of the for() loop:
Hope it helps.