Why is the following code not working?
if(EventLog.Exists("Foo"))
{
EventLog.Delete("Foo");
}
if(EventLog.Exists("Foo") == false)
{
EventLog.CreateEventSource("Foo", "Foo");
EventLog.GetEventLogs().First(x => x.Log == "Foo").ModifyOverflowPolicy(OverflowAction.OverwriteAsNeeded, 0);
EventLog.GetEventLogs().First(x => x.Log == "Foo").MaximumKilobytes = 100000;
}
The overflow policy is correctly being changed, but the maximum size stays at the default 512KB. What am I doing wrong?
Thanks!