title: Azure How to log exceptions from WebRole.OnStart
body: <p>I'm trying like crazy to figure out what is going wrong in <code>WebRole.OnStart()</code>. I know <em>where</em> the issue is occurring. I just don't know <em>what</em> the issue is.</p>
  
  <p>I have added the following to web.config:</p>
  
  <pre><code>&lt;system.diagnostics&gt;
      &lt;trace&gt;
        &lt;listeners&gt;
          &lt;add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, 
              Microsoft.WindowsAzure.Diagnostics, 
              Version=2.4.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;
  </code></pre>
  
  <p>I have also added the following to <code>WebRole.OnStart()</code></p>
  
  <pre><code>Trace.TraceInformation("OnStart()");
  
  try
  {
      CallMethodThatCausesException();
  }
  catch (Exception ex)
  {
      Trace.TraceError("Exception: " + ex.ToLogString());
      throw;
  }
  </code></pre>
  
  <p>I have also set a custom plan in the WebRole Diagnostics:</p>
  
  <p><a href="https://imgur.com/8VyrnLk" rel="nofollow noreferrer"><img src="https://i.imgur.com/8VyrnLk.png" title="Hosted by imgur.com" /></a></p>
  
  <p>However, I can't find any log files, tables in <code>TableStorage</code>, or blobs in <code>BlobContainers</code> that contain either of the <code>Trace</code> statements above.</p>
  
  <p>I do see <code>WADLogsTable</code> but The only entries that I see are <code>Loaded "Microsoft.WindowsAzure.ServiceRuntime, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"</code>.</p>
  
  <p>Within the event logs I do see an exception:</p>
  
  <p><code>Description: The process was terminated due to an unhandled exception.
  Exception Info: System.IO.FileLoadException
  Stack:
     at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.&amp;lt;InitializeRole&amp;gt;b__0()
     at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
     at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
     at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
     at System.Threading.ThreadHelper.ThreadStart()</code></p>
  
  <p>Any help would be greatly appreciated!</p>