Logs not showing up in Application Log in Event Viewer

Topics: Logging Application Block
Oct 15, 2015 at 10:08 AM
Hello Everyone,
                      I'm trying to write logs in Application log in Event Viewer using Enterprise Library 6. Its working fine when writing to any flat file. Unfortunately for Event log it isn't. Not sure what I'm missing out here. Kindly suggest.
Following are the configurations -

App.config -

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
        <add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            source="Enterprise Library Logging" formatter="Text Formatter"
            log="Demo Application" machineName="." traceOutputOptions="DateTime, ProcessId, ThreadId"
            asynchronous="true" />
        <add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            fileName="D:\Projs\ExampleConsole\ExampleConsole\trace.log"
            traceOutputOptions="DateTime, ProcessId, ThreadId" />
    </listeners>
    <formatters>
        <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
            name="Text Formatter" />
    </formatters>
    <categorySources>
        <add switchValue="All" name="General">
            <listeners>
                <add name="Event Log Listener" />
                <add name="Flat File Trace Listener" />
            </listeners>
        </add>
    </categorySources>
    <specialSources>
        <allEvents switchValue="All" name="All Events" />
        <notProcessed switchValue="All" name="Unprocessed Category" />
        <errors switchValue="All" name="Logging Errors &amp; Warnings">
            <listeners>
                <add name="Event Log Listener" />
                <add name="Flat File Trace Listener" />
            </listeners>
        </errors>
    </specialSources>
</loggingConfiguration>
<startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

Code -

using Microsoft.Practices.EnterpriseLibrary.Logging;

static void Main(string[] args)
{
            Logger.SetLogWriter(new LogWriterFactory().Create());
            LogEntry entry = new LogEntry();
            entry.Message = "Please provide valid Filename";
            Logger.Write(entry);
}
Oct 15, 2015 at 1:30 PM
Edited Oct 16, 2015 at 6:53 AM
Edited my comments. As i made a mistake. It still not going in Event viewer. Any suggestions Please. Thanks in advance.