Partilhar via


CrashDumps.EnableCollection Method (Boolean)

 

Enables collection of mini crash dumps or full crash dumps for a role instance.

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

Syntax

public static void EnableCollection(
    bool enableFullDumps
)
public:
static void EnableCollection(
    bool enableFullDumps
)
static member EnableCollection : 
        enableFullDumps:bool -> unit
Public Shared Sub EnableCollection (
    enableFullDumps As Boolean
)

Parameters

Remarks

When you enable collection of crash dumps, the resulting data is written to the CrashDumps directory in the DiagnosticStore local resource that is automatically configured for your role.

When crash dump data is transferred to persistent storage, it is stored to the wad-crash-dumps Blob container. You can specify the transfer interval of the CrashDumps directory by setting the ScheduledTransferPeriod property of Directories.

Example

The following code snippet creates a DiagnosticMonitorConfiguration object, enables full crash dump collection, and sets a transfer interval of 30 minutes.

public override bool OnStart()
{
    // Get the default initial configuration for DiagnosticMonitor.
    DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();

    // Enable full crash dump collection.
    CrashDumps.EnableCollection(true);

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

    // Start the DiagnosticMonitor using the diagnosticConfig and our connection string.
    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfiguration);

    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

CrashDumps Class
Microsoft.WindowsAzure.Diagnostics Namespace

Return to top