I am having a lot of difficulty getting trace logs in an Azure WorkerRole written to local development storage (with the ultimate goal being Azure storage once deployed). I have googled for days and keep finding plenty of examples like this http://forums.asp.net/t/2041817.aspx?Azure+Getting+Trace+Data+to+Azure+Storage. Unfortunately, even though that discussion is as recent as March of 2015, it still references a solution that is apparently not supported. The code line
DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();
uses the DiagnosticMonitor class which is apparently now deprecated. I am either not googling the correct things, or there is a startling lack of information on how to configure trace logs in the "newest" supportable fashion. I can find plenty of information on the old "deprecated" way.
Here is what I have so far. The app.config for my worker role has this section defined:
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
In fact, that was automatically added by the template that created the WorkerRole. I didn't manually do anything with that section.
The WorkerRole section in ServiceConfiguration.csdef looks like this:
<WorkerRole name="Processor" vmsize="Small">
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
</WorkerRole>
And the related Role section in ServiceConfiguration.Local.cscfg looks like this:
<Role name="Processor">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
Then I have a Trace statement in one of the classes in my WorkerRole project that looks like this:
Trace.TraceInformation("Handling event");
The diagnostics.wadcfgx associated with the WorkerRole in the cloud project looks like this:
<?xml version="1.0" encoding="utf-8"?>
<DiagnosticsConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<WadCfg>
<DiagnosticMonitorConfiguration overallQuotaInMB="4096">
<DiagnosticInfrastructureLogs scheduledTransferLogLevelFilter="Verbose" />
<Directories scheduledTransferPeriod="PT1M">
<IISLogs containerName="wad-iis-logfiles" />
<FailedRequestLogs containerName="wad-failedrequestlogs" />
</Directories>
<PerformanceCounters scheduledTransferPeriod="PT1M">
<PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\ISAPI Extension Requests/sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Bytes Total/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Requests/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Errors Total/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Queued" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Rejected" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT3M" />
</PerformanceCounters>
<WindowsEventLog scheduledTransferPeriod="PT1M">
<DataSource name="Application!*" />
</WindowsEventLog>
<CrashDumps dumpType="Full">
<CrashDumpConfiguration processName="WaAppAgent.exe" />
<CrashDumpConfiguration processName="WaIISHost.exe" />
<CrashDumpConfiguration processName="WindowsAzureGuestAgent.exe" />
<CrashDumpConfiguration processName="WaWorkerHost.exe" />
<CrashDumpConfiguration processName="DiagnosticsAgent.exe" />
<CrashDumpConfiguration processName="w3wp.exe" />
</CrashDumps>
<Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose" />
</DiagnosticMonitorConfiguration>
</WadCfg>
<StorageAccount>teststorage</StorageAccount>
</PublicConfig>
<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<StorageAccount name="teststorage" endpoint="https://core.windows.net/" />
</PrivateConfig>
<IsEnabled>true</IsEnabled>
</DiagnosticsConfiguration>
Azure storage and compute emulator are successfully started when I run the application in Visual Studio. With all of that, I would expect to go to Server Explorer in Visual Studio, expand the Azure node all the way down to Storage. Go to the (Development) node and see that there is a table under the Tables node containing my trace logs, but there is nothing there.
Clearly I am doing something wrong and have yet to find documentation clear enough, either blog or Microsoft, that explains how to get this working. So here I am asking what would seem to be something relatively simple.