title: Why won't Log4Net work on Azure with Table Storage?
body: <p>Desperately seeking a solution to get log4net working in a Azure Worker Role. Slowly driving me c-razy.</p>
  
  <p>I've followed the steps outlined on this blog <a href="http://blog.tylerdoerksen.com/2012/04/17/logging-in-azure-part-2table-storage" rel="nofollow">http://blog.tylerdoerksen.com/2012/04/17/logging-in-azure-part-2table-storage</a> (thanks) which seem to make sense and the log4net logging works like an dream in the following conditions: </p>
  
  <ol>
  <li>Running the Worker Role in the emulator locally and persisting the logs to local Storage</li>
  <li>Running the Worker Role in the emulator locally and persisting the logs to remote staging Azure Table Storage</li>
  </ol>
  
  <p>When I deploy the Worker Role Service to Azure it logs nothing in the LogEntities table. It's this bit, this bit that is incredibly frustrating. </p>
  
  <p>I've turned on log4net debugging in the Worker Role app.config and I see the following trace in the WADLogsTable </p>
  
  <blockquote>
    <blockquote>
      <p>log4net: Finalizing appender named [TableStorageAppender].</p>
    </blockquote>
  </blockquote>
  
  <p>And that's it. No other log4net debug info that I'd normally expect to see since adding the       </p>
  
  <pre><code>&lt;appSettings&gt;
      &lt;add key="log4net.Internal.Debug" value="true"/&gt;
  &lt;/appSettings&gt;
  </code></pre>
  
  <p>to my Worker Role app.config.</p>
  
  <p>I'm configuring log4net in the Worker Role overridden Run method:</p>
  
  <pre><code>public override void Run()
   {
          try
          {
  
              XmlConfigurator.Configure();
              ILog Logger = LogManager.GetLogger(GetType());
              Trace.WriteLine("Trace: CheckInService.Run()");
              Logger.Info("log4net: CheckInService.Run()");
              //open the Service and do some other stuff etc 
              while (true)
              {
                  Thread.Sleep(1800000);
              }
          catch (Exception ex)
          {
              Trace.TraceError("There was a problem opening the CheckInService");
          }
   }
  </code></pre>
  
  <p>This is my full app.config</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" name="log4net" /&gt;
    &lt;/configSections&gt;
    &lt;appSettings&gt;
      &lt;add key="log4net.Internal.Debug" value="true"/&gt;
    &lt;/appSettings&gt;
    &lt;log4net&gt;
      &lt;appender type="Cloud.Services.Logging.TableStorageAppender, Cloud.Services.Logging" name="TableStorageAppender"&gt;
      &lt;/appender&gt;
      &lt;root&gt;
        &lt;level value="All" /&gt;
        &lt;appender-ref ref="TableStorageAppender" /&gt;
      &lt;/root&gt;
    &lt;/log4net&gt;
    &lt;system.diagnostics&gt;
      &lt;trace autoflush="true"&gt;
        &lt;listeners&gt;
          &lt;add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            name="AzureDiagnostics"&gt;
            &lt;filter type="" /&gt;
          &lt;/add&gt;
        &lt;/listeners&gt;
      &lt;/trace&gt;
    &lt;/system.diagnostics&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>The logging appender (TableStorageAppender) implementation is in it's own Assembly (Cloud.Services.Logging) but I'm assuming that wouldn't make any difference?</p>
  
  <p>Anyone got any ideas?</p>