Dears,
I 've a problem with creating event log on event viewer.
The issue is as following:
I am using this code to create event log in event viewer.
private static void WriteEventLogEntry(string message)
{
try
{
try { if (!EventLog.SourceExists("COO")) { EventLog.CreateEventSource("COO", "COOLog"); } }
catch (Exception) { }
EventLog Log = new EventLog();
Log.Source = "COOLog";
Log.WriteEntry(message, EventLogEntryType.Error, 0);
}
catch (Exception ex) { }
}
Actually, Everything is done very well on my PC.
but after publishing to server, i faced a permission issue that i must be administrator.
I thought i could create this file manually by using command prompt or something else but i couldn't do that.
So, now can any one help me how to solve this permission issue by code or add event log to (Applications and services logs) Folder manually by command prompt?
Thanks in advance.
What I have tried:
I have tried this line to add it by command prompt, but the log is created in Application logs not in (Applications and services logs) Folder.
eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO COO /D "COOLog"