Collect Logging Data by Using Azure Diagnostics
Updated: December 22, 2014
Windows Azure Diagnostics enables you to collect diagnostic data from an application running in Windows Azure. You can use diagnostic data for debugging and troubleshooting, measuring performance, monitoring resource usage, traffic analysis and capacity planning, and auditing. After the diagnostic data is collected it can be transferred to a Windows Azure storage account for persistence. Transfers can either be scheduled or on-demand.
You can configure Diagnostics using a XML configuration file. You can also configure it remotely from an application running outside of Windows Azure. For example, you can manage Diagnostics from a custom dashboard application running outside Windows Azure. By managing Diagnostics remotely, you can start your application with an initial diagnostic configuration, and then change that configuration from code running outside of your application without having to update the application.
The following provides more information on Diagnostics:
Initialize or Change Azure Diagnostics Configuration
Trace the Flow of Your Azure Application
Create and Use Performance Counters in an Azure Application
Store and View Diagnostic Data in Azure Storage
Breaking Changes in Azure Diagnostics (SDK 2.0)
You collect diagnostic data by importing the Diagnostics module into the service model and by configuring data sources from which diagnostic data is collected. You can store the diagnostic data by transferring the data to Windows Azure storage. The Diagnostics monitor runs in Windows Azure and in the Microsoft Azure compute emulator to collect diagnostic data for a role instance. A role instance that uses the Diagnostics module automatically starts the diagnostic monitor when the role instance starts. Sources for diagnostics data must be added to the configuration of the diagnostic monitor to collect the data. In addition to Windows Azure logs, IIS 7.0 logs, and Windows Azure Diagnostic infrastructure logs, you can collect log data from other sources such as IIS failed request trace logs, Windows Event logs, crash dumps, and custom error logs. You can begin setting up Diagnostics by using the information in Initialize or Change Azure Diagnostics Configuration.
You can add tracing and debugging instrumentation to your Windows Azure application when you develop it, and you can use that instrumentation both while you are developing the application and after you have deployed it. The implementation of tracing can help you validate the flow of your application while it is running and you can use tracing to debug problems that might occur in your application. For more information about instrumenting your application for tracing, see Trace the Flow of Your Azure Application.
You can use performance counters to measure the health of your Windows Azure application. You can collect data from existing performance counters or you can create custom performance counters to collect additional data. For more information about performance counters, see Create and Use Performance Counters in an Azure Application.
You collect diagnostic data by importing the Diagnostics module into the service model and then configuring data sources from which diagnostic data is collected. Diagnostic data that is collected in the data sources is not persisted unless it is transferred to Windows Azure storage. You configure the diagnostic monitor to use a specific storage account for performing transfers. To perform the transfers, you must ensure that the correct credentials are used. The target storage can be the storage emulator, if you are running your application in the compute emulator, or it can be a Windows Azure storage account, which is the same account where the diagnostics configuration is stored. Diagnostic data can be transferred to storage at scheduled intervals or on-demand. For more information about storing and viewing diagnostic data, see Store and View Diagnostic Data in Azure Storage.
For information on breaking changes in Windows Azure SDK for .NET 2.0, see Breaking Changes in Azure Diagnostics (SDK 2.0).