I am attempting to create my own custom event log using the below code:
if (!System.Diagnostics.EventLog.SourceExists("DataStream"))
{
EventLog.CreateEventSource("DataStream", "SIRsDetectionDataStreamLog");
}
logger = new EventLog();
logger.Source = "DataStream";
However, I keep getting a security error when checking if the source exists. The error I get is as follows:
SecurityException was unhandled
An unhandled exception of type 'System.Security.SecurityException' occurred in System.dll
Additional information: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.