Hello, In C# VS2008 I have a service which can run from command line and as registered service. I am trying to debug my Service process I wondered why it does not write logs in event viewer. I have a logger as this:
public static void Log(string s, EventLogEntryType et) {
try {
if (CService.asService) {
if (!EventLog.SourceExists("Jobs")) {
EventLog.CreateEventSource("Jobs", "JobsServiceLog");
}
EventLog.WriteEntry("Jobs", s,
et, 234);
}
else {
Console.WriteLine(s);
}
}
catch { }
}
Then somewhere I am logging: Log("Jobs service started", EventLogEntryType.Information);
Nothing is appear in the Event Viewer->JobsServiceLog.
What can be reason?
thanks
Arman.