SALES: 1-800-867-1380

DiagnosticMonitorConfiguration Class

 

Updated: December 6, 2013

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)

System.Object
  Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration

public class DiagnosticMonitorConfiguration

NameDescription
System_CAPS_pubmethodDiagnosticMonitorConfiguration()

Initializes a new instance of the DiagnosticMonitorConfiguration class.

NameDescription
System_CAPS_pubpropertyConfigurationChangePollInterval

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

System_CAPS_pubpropertyDiagnosticInfrastructureLogs

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_pubpropertyDirectories

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

System_CAPS_pubpropertyLogs

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

System_CAPS_pubpropertyOverallQuotaInMB

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

System_CAPS_pubpropertyPerformanceCounters

Gets or sets the buffer configuration for performance counter data.

System_CAPS_pubpropertyWindowsEventLog

Gets or sets the buffer configuration for Windows event logs.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(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

Description

DiagnosticInfrastructureLogs

Enabled, stored locally, no transfer to persistent storage defined

Logs specific to the diagnostics infrastructure itself.

Logs

Enabled, stored locally, no transfer to persistent storage defined

Logs specific to Windows Azure.

ConfigurationChangePollInterval

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

Directories

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.

OverallQuotaInMB

4,080MB

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

PerformanceCounters

Disabled

No performance counters are specified in the default configuration.

WindowsEventLog

Disabled

No DataSources are specified for Windows Event logs.

Example

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;

   roleInstance.SetCurrentConfiguration(diagnosticConfiguration);
}
System_CAPS_warningWarning

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.

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

Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft