Export (0) Print
Expand All
1 out of 3 rated this helpful - Rate this topic

DiagnosticMonitorTraceListener Class

Represents the trace listener used for basic Windows Azure logs.

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

public class DiagnosticMonitorTraceListener : TraceListener

The DiagnosticMonitorTraceListener class is used to log trace data for hosted services. All tracing data is stored as a part of Windows Azure logs, and does not transfer to persistent storage by default. To enable transfers to persistent storage, you must configure the Logs property and set your desired options for scheduled transfers. Additionally, you must have a storage account configured in the ServiceConfiguration.cscfg file. Transferred trace data is located in the WADLogsTable of the storage account.

There are two ways to enable tracing for your web or worker role: modifying app.config or web.config, or programmatically calling the System.Diagnostics.Trace.Listeners.Add method.

To enable tracing using web.config or app.config

Add the following code to the web.config or app.config configuration file:

         <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, 
            <filter type="" />

To enable tracing programmatically

Add the following line of code:

System.Diagnostics.Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());

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

Community Additions

© 2014 Microsoft. All rights reserved.