I'm trying to write to the application event log. The following code executes without error under Windows 8 (when run with admin privileges), but I don't see any events showing up when looking at the Application log in the Windows Event Viewer. Can anyone help me figure out what I'm doing wrong. Do I need to add something to app.config?
using System.Diagnostics;
namespace tracetest2
{
    class Program
    {
        static void Main(string[] args)
        {
            if (!EventLog.SourceExists("TestSource"))
            {
                EventLog.CreateEventSource("TestSource", "Application");
            }
            EventLog appLog = new EventLog("Application", ".", "TestSource");
            appLog.EnableRaisingEvents = true;
            appLog.EndInit();
            Debug.WriteLine(appLog.Entries.Count);
            appLog.WriteEntry("An entry to the Application event log.");
            Debug.WriteLine(appLog.Entries.Count);
        }
    }
}