Setting the trace level for windows azure logging

It can be confusing to determine how you can set your default trace logging level to in windows azure. You have to set it like this, so the system can understand that all the stuff you are writing to the log is actually going as log level 2, which is warning. Otherwise, if you use caching (say) too many log lines to make sense of it all.

http://msdn.microsoft.com/en-us/library/system.diagnostics.tracelevel.aspx


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

In addition to this, you have to specify to Azure what level of the log you want to put in the table:


DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();
config.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Warning;
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);


REF: http://msdn.microsoft.com/en-us/magazine/ff714589.aspx

Comments

Popular posts from this blog

Tutorial: Using Google Cloud Storage from C# and .NET

Late 2008 Macbook only giving 1.5 gb/s speed with 6 gb/s Intel SSD?

Enable Visual Studio to use more than 2GB of memory