In my windows service application (c#), I am checking if an event log exists then write to that event log, otherwise create new event log and write to it. But it always writes to the generic "Application" event log. Do I need to change some settings?
class WriteToEventLog
{
private static string sSource = "GCService";
private static string sLog = "GCService";
public bool WriteErrorLog(string originator, string Message, string ExceptionString, int EventID)
{
..
if (!EventLog.SourceExists(sSource)) EventLog.CreateEventSource(sSource, sLog);
EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Error, EventID);
return true;
}
....
}
...
Go to the complete details ...