Search code examples
azureazure-web-rolesazure-diagnostics

Azure role ( WCF services ) is not logging trace information


I'm hosting a bunch of WCF services in worker role, which I'm deploying to Azure. Problem is that the standard Trace logging isn't showing up in the Azure storage tables.

In code - I'm using

Trace.TraceInformation("Something")

In the .csdef I've got the default

<Imports>
    <Import moduleName="Diagnostics" />
</Imports>

In the .csfg I've got

   <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="CONNECTION_STRING_THAT_WORKS_FOR_OTHER_ROLE" />
  </ConfigurationSettings>

And in the wadcfg I've got

  <Logs bufferQuotaInMB="1024" scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose" />

This setup works fine for a worker role that I'm deploying too, which logs nicely in the WADLogsTable. But this one isn't. Any pointers?


Solution

  • We solved this later by modifying not the Azure project but the underlying webrole:

    1 - Add a file webrole.cs to the project, having this inside:

    public class WebRole : RoleEntryPoint
    {
        public override bool OnStart()
        {    
            return base.OnStart();
        }
    }
    

    2 - And this is the app.config of the same project:

    <system.diagnostics>
        <trace>
          <listeners>
            <add name="AzureDiagnostics" type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <filter type="" />
            </add>
          </listeners>
        </trace>
      </system.diagnostics>
    

    That fixed it for us