I had a hard time trying to get some diagnostics from a RoleEntryPoint.
I was doing some setup in this entry point and getting some errors.
So I tought, mmmm: this is a Task for the super Azure DiagnosticMonitor.
And I added a bunch of Trace statements and waited to get some output in my WADLogsTables,
but NOTHING!!! ZERO NILCH! NADA!!
What happenned!!!
I took me a while to get to it. So
This is the things. I had to do.
1. First add a file called WaIISHost.exe.config
2. Add the Azure Diagnostics Trace Listener
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add name="AzureDiagnostics" type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
</configuration>
3. And very very important, you must go to Copy to Output Directory property for this file and set it to Copy Always.
4. And another thing that you need is a lot of patience. The Diagnostics infraestructure takes a while.
So you add a Thread.Sleep after the Start call
DiagnosticMonitor.Start(storageAccount, configuration);
Thread.Sleep(10000);
5. After you do that you will be able to collect some information from the WADLogsTables