DiagnosticMonitor.GetDefaultInitialConfiguration Method ()

 

Returns the default initial diagnostic monitor configuration for the current role instance.

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

Syntax

public static DiagnosticMonitorConfiguration GetDefaultInitialConfiguration()
public:
static DiagnosticMonitorConfiguration^ GetDefaultInitialConfiguration()
static member GetDefaultInitialConfiguration : unit -> DiagnosticMonitorConfiguration
Public Shared Function GetDefaultInitialConfiguration As DiagnosticMonitorConfiguration

Return Value

Type: Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration

Type: Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration

A DiagnosticMonitorConfiguration with the default configuration.

Remarks

The GetDefaultInitialConfiguration method returns a DiagnosticMonitorConfiguration object that specifies the default configuration for all logging and diagnostic buffers. When the initial configuration has been returned, you can modify its properties and use the updated configuration instead.

The default configuration 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 located 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 ServiceConfiguration.cscfg snippet and WebRole.cs code snippet create a DiagnosticMonitorConfiguration object in a web role’s overridden OnStart method and adds a custom transfer interval.

ServiceConfiguration.cscfg

<ConfigurationSettings>
  <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>

WebRole.cs

public class WebRole : RoleEntryPoint
{
    public override bool OnStart()
    {
        // Create a new DiagnosticMonitorConfiguration object.
        DiagnosticMonitorConfiguration dmConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();

        // Transfer the default log containers to a storage account every 30 minutes.
        dmConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);

        // Start the DiagnosticMonitor with the new DiagnosticMonitorConfiguration.
        try
        {
            DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmConfig);
        {
        catch (ArgumentException ae)
        {
            // Handle any exceptions.
            System.Diagnostics.Trace.WriteLine(“Couldn’t start the DiagnosticMonitor.” + ae.Message);
        }

        return base.OnStart();
    }
}

Warning

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.

See Also

DiagnosticMonitor Class
Microsoft.WindowsAzure.Diagnostics Namespace

Return to top