Экспорт (0) Печать
Развернуть все

DiagnosticMonitor - класс

Represents the diagnostic monitor for a role instance in Windows Azure.

Пространство имен: Microsoft.WindowsAzure.Diagnostics
Сборка: Microsoft.WindowsAzure.Diagnostics (в microsoft.windowsazure.diagnostics.dll)

'Применение
Dim instance As DiagnosticMonitor

public class DiagnosticMonitor
public class DiagnosticMonitor
public class DiagnosticMonitor

The DiagnosticMonitor class provides methods and properties that enable collection of diagnostic data for a role instance in Windows Azure. DiagnosticMonitor is a singleton, so each role instance has only one instantiated DiagnosticMonitor.

By default for web roles and worker roles, DiagnosticMonitor collects Windows Azure logs and Windows Azure Diagnostic Infrastructure logs. For web roles only it will also collect IIS logs by default. These logs are included in the default configuration returned by the GetDefaultInitialConfiguration method. You can configure additional logging options by creating a DiagnosticMonitorConfiguration object, specifying the diagnostics data you want by setting the properties of that object, and passing the object as a parameter to the Start(String,DiagnosticMonitorConfiguration) method.

You can specify a storage location for the DiagnosticMonitor by including a connection string or a CloudStorageAccount object as an input parameter when calling the Start(String) method.

noteПримечание
If you call the Start(String) method using a misconfigured connection string or CloudStorageAccount, the DiagnosticMonitor will not start with your role instance.

To use DiagnosticMonitor, you must perform the following steps:

  1. Import the Diagnostics module into your application by modifying the ServiceDefinition.csdef file to include the following lines:

    <Imports>
        <Import moduleName=”Diagnostics” />
    </Imports>
    
  2. Specify a storage location where the diagnostics data will be transferred, either a Windows Azure storage account or the local storage emulator. For example, modify your ServiceConfiguration.cscfg file to include the following lines if you want to store diagnostics data in the storage emulator:

    <ConfigurationSettings>
         <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
    </ConfigurationSettings>
    
    
  3. Make sure that your project includes a reference to Microsoft.WindowsAzure.Diagnostics.dll, and optionally includes a using Microsoft.WindowsAzure.Diagnostics; directive in each code file that uses the DiagnosticMonitor.

See How to Initialize the Windows Azure Diagnostic Monitor for more information on configuring these details in your project.

After the DiagnosticMonitor has been configured, if you want to start collecting the default logs, you do not need to call the Start(String) method. Roles that have imported the Diagnostics module, specified a data storage location, and referenced the .dll will automatically start the DiagnosticMonitor using the default configuration when the role initializes.

However, if you want to specify a custom logging configuration, you must call the Start(CloudStorageAccount,DiagnosticMonitorConfiguration) method and supply the storage account and your custom DiagnosticMonitorConfiguration object as parameters to the method. This call is show in the following example where dmConfig is a custom DiagnosticMonitorConfiguration object:

DiagnosticMonitor.Start(“Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString”, dmConfig)

System.Object
  Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor

Все открытые статические (Совместно используемая в Visual Basic) члены этого типа являются потокобезопасными. Потокобезопасность членов экземпляров не гарантируется.

Платформы разработки

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2008 и Windows 2000

Целевые платформы

Добавления сообщества

Показ:
© 2014 Microsoft