SALES: 1-800-867-1380
1 out of 1 rated this helpful - Rate this topic

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)
'Usage

public class DiagnosticMonitorConfiguration

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 Using the Windows Azure Diagnostics Configuration File.

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.Object
  Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7 and Windows Server 2008

Target Platforms

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.