DiagnosticMonitorConfiguration Class


Represents the configuration for a set of data buffers for logging and diagnostic information.

Namespace:   Microsoft.WindowsAzure.Diagnostics
Assembly:  Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)

Inheritance Hierarchy



public class DiagnosticMonitorConfiguration
public ref class DiagnosticMonitorConfiguration 
type DiagnosticMonitorConfiguration = class end
Public Class DiagnosticMonitorConfiguration


Name Description
System_CAPS_pubmethod DiagnosticMonitorConfiguration()

Initializes a new instance of the DiagnosticMonitorConfiguration class.


Name Description
System_CAPS_pubproperty ConfigurationChangePollInterval

Gets or sets the interval at which the diagnostic monitor polls for diagnostic configuration changes.

System_CAPS_pubproperty DiagnosticInfrastructureLogs

Gets or sets the buffer configuration for the logs generated by the underlying diagnostics infrastructure. The diagnostic infrastructure logs are useful for troubleshooting the diagnostics system itself.

System_CAPS_pubproperty Directories

Gets or sets the buffer configuration for file-based logs, including custom logs.

System_CAPS_pubproperty Logs

Gets or sets the buffer configuration for basic Windows Azure logs captured by the Windows Azure Trace Listener.

System_CAPS_pubproperty OverallQuotaInMB

Gets or sets the total amount of local storage allocated for all logging buffers.

System_CAPS_pubproperty PerformanceCounters

Gets or sets the buffer configuration for performance counter data.

System_CAPS_pubproperty WindowsEventLog

Gets or sets the buffer configuration for Windows event logs.


Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)


The DiagnosticMonitorConfiguration class is used to store configured data buffers for each logging area in a Windows Azure application. In addition, you use it to specify how frequently to poll for changes to the diagnostics configuration, and to set the maximum amount of local storage to allocate for storing logs.

The diagnostics.wadcfg file is used to configure diagnostics in your application. For more information on how to configure your diagnostics.wadcfg file, see Enabling Diagnostics in Windows Azure. If the diagnostics monitor is started without a diagnostics.wadcfg file, the default configuration is used. Once your application is running in Windows Azure, you can use the DiagnosticMonitorConfiguration class along with the RoleInstanceDiagnosticManager class to remotely change your application’s diagnostics configuration. The default configuration is identical to the configuration returned by calling GetDefaultInitialConfiguration, and is specified below:

Data Source

Default Configuration



Enabled, stored locally, no transfer to persistent storage defined

Logs specific to the diagnostics infrastructure itself.


Enabled, stored locally, no transfer to persistent storage defined

Logs specific to Windows Azure.


1 minute

Checks every minute for diagnostics configuration changes in the diagnostics.wadcfg file in wad-control-container. For more information on using this file, see .e4f3c96e-d9ad-4a9d-9c60-99b9bb09409a


wad-iis-failedreqlogfiles, wad-iis-logfiles, and wad-crash-dumps directories are specified by default, each with their DirectoryQuotaInMB property set to 1024MB.

These are the names of the storage containers where applicable log data will be transferred at the specified transfer interval.



4GB of local storage is allocated for the combined total of the logging sources. If you want to increase the overall quota beyond 4GB, you must make the changes in the ServiceConfiguration.cscfg file. Changing this property to a value larger than 4GB will not result in an increased quota. However, if you want to decrease the quota size, you can change the value of this property. For more information, see OverallQuotaInMB



No performance counters are specified in the default configuration.



No DataSources are specified for Windows Event logs.


The following example gets the current configuration for each instance in a specific role, customizes the diagnostic infrastructure logs data buffer, and sets the configuration.

// Get the connection string. It's recommended that you store the connection string in your web.config or app.config file.
// Use the ConfigurationManager type to retrieve your storage connection string.  You can find the account name and key in
// the Windows Azure Management Portal (http://manage.windowsazure.com).
//string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;

// The deployment ID and role name for your application can be obtained from the 
// Windows Azure Management Portal (http://manage.windowsazure.com). See your 
// application dashboard under Cloud Services.
string deploymentID = "e2ab8b6667644666ba627bdf6f5e4daa";
string roleName = "WebRole1";

// Get the DeploymentDiagnosticManager object for your deployment.
DeploymentDiagnosticManager diagManager = new DeploymentDiagnosticManager(connectionString, deploymentID);

// Get the RoleInstanceDiagnosticManager objects for each instance of your role.
IEnumerable<RoleInstanceDiagnosticManager> instanceManagers = diagManager.GetRoleInstanceDiagnosticManagersForRole(roleName);

// Iterate through the role instances and update the configuration.
foreach (RoleInstanceDiagnosticManager roleInstance in instanceManagers)
  DiagnosticMonitorConfiguration diagnosticConfiguration = roleInstance.GetCurrentConfiguration();

   // Filter the logs so that only error-level logs are transferred to persistent storage.
   diagnosticConfiguration.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = LogLevel.Error;

   // Schedule a transfer period of 30 minutes.
   diagnosticConfiguration.DiagnosticInfrastructureLogs.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);

   // Specify a buffer quota.
   diagnosticConfiguration.DiagnosticInfrastructureLogs.BufferQuotaInMB = 1024;



This API is not supported in Azure SDK versions 2.5 and higher. Instead, use the diagnostics.wadcfg XML configuration file. For more information, see Collect Logging Data by Using Azure Diagnostics.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.WindowsAzure.Diagnostics Namespace

Return to top