Difference between System eventlog and those created by EventLog c

Difference between System eventlog and those created by EventLog c

Post by RGF2aWQgU2 » Fri, 15 Oct 2004 08:25:03


Hi,

My application write custom event log (i.e. NOT to the standard "system",
"application" or "Security" ones) using the EventLog class in .NET. The code
is essentially the same as those included in the MSDN library document for
EventLog.

using System;
using System.Diagnostics;
using System.Threading;

class MySample{

public static void Main(){

// Create the source, if it does not already exist.
if(!EventLog.SourceExists("MySource")){
EventLog.CreateEventSource("MySource", "MyNewLog");
Console.WriteLine("CreatingEventSource");
}

// Create an EventLog instance and assign its source.
EventLog myLog = new EventLog();
myLog.Source = "MySource";

// Write an informational entry to the event log.
myLog.Wri *** try("Writing to event log.");

}
}


I found that these event logs I created using EventLog are ***different***
from those default event logs come with XP (again, those "System",
"Application" etc.)

For one, althogh I can see the event in EventViewer without problem, but
when I right click on my event log (for example, "MyNewLog", which is created
using the above sample), the properties for it is different from those for
the default system event log. The log name field is greyed out (empty) and
the Size, Created, Modified, and Accessed values are all empty (shown as "Not
avaiable".

The problem is that I tried to access my custom event log using the WMI.
With script such as this one:

Select * from Win32_NTEventlogFile

It only returns 3 objects, namely the default system event log ("system",
"application", and "security"). My custom event log file is NOT returned.

The static EventLog.GetEventLog (in .net) does returns me the correct
collections of event log files. But my application requires me to access
those files through WMI. I am stuck at here.

I have spend quit sometime trying to find out why. Any help will be
appreciated.

Thanks.

David
 
 
 

Difference between System eventlog and those created by EventLog c

Post by RGF2aWQgU2 » Sun, 17 Oct 2004 07:09:03

Can MVP please help? Thanks.

 
 
 

Difference between System eventlog and those created by EventLog c

Post by RGF2aWQgU2 » Thu, 21 Oct 2004 03:35:01

Still trying to find a solution to this problem. Can anyone please help?

Thanks.
 
 
 

Difference between System eventlog and those created by EventLog c

Post by michael » Wed, 17 Nov 2004 12:18:37

I was adviced by MS Platform SDK Team, that this is a known issue. The
fix will be available in Windows Server 2003 Service Pack 1. The fix
will allow you to access custom EventLogs that were created using .Net
EventLog.CreateEventSource.

Michael Freidgeim.