CrossCuttingConcerns project

New in V1.7.

The CrossCuttingConcerns project handles cross-cutting concerns like logging and diagnostics, this functionality is used by all the projects in the solution and by both roles, so the code does not belong anywhere else than in a separate project.


The AzureDiagnostics class handles all kinds of logging and diagnostics from the Azure server instances to the Azure Table Storage and Blob Storage. By default a lot of logging and diagnostics is enabled, much more than you probably want after you go live, therefore you should alter your settings in here. Since this class is called "all over the place" we can not the settings in a application configuration file or in the role settings, all settings are therefore hard-coded in the class.

The AzureDiagnostics.EnableAzureDiagnostics() is what enables diagnostics for a Azure role, it is by default called from all the role OnStart() methods.

This video goes through all of the concepts that the AzureDiagnostics class handles:


These are the Azure Tables that are created by the AzureDiagnostics class:
  • WADDiagnosticsInfrastructureLogs is the Azure infrastructure log,
  • WADDirectoriesTable contains references to all the file-based logs that are stored in the Azure Blob Storage (the IIS logs),
  • WADLogsTable is the diagnostics logs (see System.Diagnostics.Trace for more information about trace logs),
  • WADPerformaceCountersTable is the log for your performance counters (by default only the processor percentage is tracked)
  • WADWindowsEventLogsTable contains the Windows Application and System logs by default.

Blob containers

By default the AzureDiagnostics class creates the wad-iis-logfiles Azure blob container, this blob contains all the IIS logfiles in the W3C Extended Log File Format.

Scheduled transfers

Scheduled transfers is how often you want your logs and diagnostics being uploaded to the Azure Table Storage and Blob Storage.

The AzureDiagnostics.SetDiagnositcManagerScheduledTransferPeriods() method sets how often the scheduled transfers should occur. Commenting out a line here will disable the logging or diagnostics of that type. By default all scheduled transfers are set to 5 minutes.

Crash dumps

By default full crash dumps are stored as a blob in the Azure Blob Storage.

Full crashdumps are not available in roles as the exception is always caught. The only exception here is when the role is starting, as that happens in another non-ASP.NET process

Performance counters

Performance counters are enabled by default by AzureProviders, the counters that are to be tracked is set in the AzureDiagnostics.AddPerformanceCounterMonitoring() method, by default only the processor percentage is tracked.

Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration.CounterSpecifier is language specific, so if you run your developer environment in another language OS that an English one you may get into trouble. For a complete list of possible PerformanceCounterConfiguration.CounterSpecifier values for your OS language run "typeperf.exe /Q" in a console. By default the sample rate is every 15 seconds from the tracked performance counters, you may want to tweak this to get less log entries.

Windows Event logs

By default all Windows events to the Application and System logs are stored in the Azure Table Storage, you can change this in the _AzureDiagnostics.AddEventLoggingFromWindowsEventLog() method. Decide here what Windows event logs you are interested in seeing, you can also filter out events if you want to. The syntax is <channel>!XPath Query , see for more information.

Last edited Oct 2, 2011 at 2:29 PM by ihenriksen, version 3


No comments yet.