EntLib 5.0 Logging in Azure not working

Topics: Logging Application Block, Windows Azure Integration Pack
Dec 28, 2011 at 8:44 PM
Edited Dec 28, 2011 at 8:47 PM

I have been trying to get EntLib logging block to work and log to my azure development environment but cannot get it to work. I follow this example (http://blogs.msdn.com/b/tomholl/archive/2010/09/06/get-logging-in-windows-azure-with-enterprise-library.aspx) which seems pretty straight forward but nothing logs. If I replace my log statement with the standard Trace.Write("write my stuff") everthing logs fine and shows up in my WADLogsTable as expected. However as soon as I switch to this code nothing shows up.

Logger.Write("Get Logging in Windows Azure with Enterprise Library!", "General", 1, 0, System.Diagnostics.TraceEventType.Information);

Here is my config file.

 <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
 

<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
      <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        source="Enterprise Library Logging"
            name="MyListener"/>
    </listeners>

 <categorySources>
      <add switchValue="All" name="General">
        <listeners>
          <add name="MyListener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events">
        <listeners>
          <add name="MyListener" />
        </listeners>
      </allEvents>
      <notProcessed switchValue="All" name="Unprocessed Category">
        <listeners>
          <add name="MyListener" />
        </listeners>
      </notProcessed>
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="MyListener" />
        </listeners>
      </errors>
    </specialSources>

 

As you can see I have it configed for Azure diagonstics and all events pointing to my listener. Why does it not work?

    
 
 
 
Dec 30, 2011 at 7:45 AM
Edited Dec 30, 2011 at 7:48 AM

You have set the listenerDataType to be FormattedEventLogTraceListenerData.  It should be set to SystemDiagnosticsTraceListenerData.

 

<listeners> <add name="MyListener" type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.SystemDiagnosticsTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" source="Enterprise Library Logging" /> </listeners>

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com 

Dec 30, 2011 at 4:52 PM

Thanks for catching that. It was indeed the issue.