Has anyone noticed that the Eventlog Class is slow? I'm trying to read log entries of a particular source from the application log. There is a total of 6000+ entries in the Application log. When I read from the local machine it is relatively fast, but over the network it can take up to 2 minutes of read from the eventlog. The standard "Event Viewer" tool that comes windows XP reads the same network data in seconds. The example listed at the end of this mail is based on code from the SDK documentation. I want to filter against EventlogEntry source. Is my code just wrong or should I use the API?
Any help you may have will be much appreciated? Simon Powell private void Form1_Load(object sender, System.EventArgs e) { listView1.Columns.Add("Date Time", 100, HorizontalAlignment.Left); listView1.Columns.Add("Event Type", 100, HorizontalAlignment.Left); listView1.Columns.Add("Event Message", 100, HorizontalAlignment.Left); listView1.View = View.Details; this.Text = "Current Webstation Eventlog messages : " + CurMachine; EventLog NTIlog = new EventLog("Application",CurMachine); EventLogEntryCollection myLogEntryCol = NTIlog.Entries; foreach(EventLogEntry entry in myLogEntryCol) { if(entry.Source.IndexOf("PontisInstallAgent") != -1) { ListViewItem item = listView1.Items.Add(entry.TimeGenerated.ToString()); switch(entry.EntryType.ToString()) { case "Error" : item.BackColor = Color.Red; item.ForeColor = Color.White; break; case "Warning" : item.BackColor = Color.Yellow; item.ForeColor = Color.Black; break; default : item.BackColor = Color.White; item.ForeColor = Color.Black; break; } item.SubItems.Add(entry.EntryType.ToString()); item.SubItems.Add(entry.Message); } } foreach(ColumnHeader col in listView1.Columns) { col.Width = -2; } } ---------------------------------------------------------------------- If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. ---------------------------------------------------------------------- You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.