DiagnosticMonitor.Start Method (String)

 

Starts a diagnostic monitor using the specified storage account and default diagnostic monitor configuration.

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

Syntax

public static DiagnosticMonitor Start(
    string diagnosticsStorageAccountConfigurationSettingName
)
public:
static DiagnosticMonitor^ Start(
    String^ diagnosticsStorageAccountConfigurationSettingName
)
static member Start : 
        diagnosticsStorageAccountConfigurationSettingName:string -> DiagnosticMonitor
Public Shared Function Start (
    diagnosticsStorageAccountConfigurationSettingName As String
) As DiagnosticMonitor

Parameters

Return Value

Type: Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor

Type: Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor

Returns DiagnosticMonitor.

Remarks

This method starts a DiagnosticMonitor using the specified storage account and the default DiagnosticMonitorConfiguration. For more information about the default configuration, see GetDefaultInitialConfiguration.

Data buffers are transferred to the storage account indicated by the specified configuration setting. The storage account can be the local storage emulator, or a Windows Azure storage account in the cloud.

This method also registers the diagnostics monitoring agent for notification when changes to configuration settings occur. If the value of the connection string is changed in the ServiceConfiguration.cscfg file, the diagnostics monitoring agent will be automatically reconfigured to use the new connection.

Note

If your storage account is misconfigured, your role instance will start without diagnostics. To ensure that diagnostics will start, verify that your storage account is configured correctly before calling the Start method.

Example

The following code snippet starts the DiagnosticMonitor using the connection string specified in the ServiceConfiguration.cscfg file:

WebRole.cs

public class WebRole : RoleEntryPoint
{
    public override bool OnStart()
    {
        // Start the DiagnosticMonitor with the default DiagnosticMonitorConfiguration.
        DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString");

        return base.OnStart();
    }
}

ServiceConfiguration.cscfg

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

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

Start Overload
DiagnosticMonitor Class
Microsoft.WindowsAzure.Diagnostics Namespace

Return to top