I spent a day trying to make Ent Lib Logging work and log anything into database or event log. I have a web application and console application with the same Ent Lib config but
or use this code....
public static void RunSnippet(string logName, string eventSource)
{
// this will throw an exception if you don't have admin rights
if (!EventLog.SourceExists(eventSource))
{
System.Diagnostics.EventLog.CreateEventSource(eventSource, logName);
Console.WriteLine("Event Log and Source: {0},{1} were created successfully.",logName, eventSource);
}
else
{
Console.WriteLine("Event log/source: {0}/{1} already exists",logName, eventSource);
}
Console.WriteLine("Done");
}