I have created an EventLog
object in my application, that I use to log to my own log, created like this:
if (!System.Diagnostics.EventLog.SourceExists("MyApplication")) {
System.Diagnostics.EventLog.CreateEventSource(
"MySource", "MyApplication");
}
eventLog.Source = "MySource";
eventLog.Log = "MyApplication";
I log entries like this:
eventLog.WriteEntry("some log line");
When inspecting the eventLog
object, it says the Log
is set to "MyApplication"
. However, the logging always goes to the Windows Application log. I must also say that the code worked until I registered another source to the same log. That "new" source logs correctly.
Update When looking at the registry, the source is created correctly (as a subkey of the log)
What could be wrong?