Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DiagnosticMonitorTraceListener Class

Updated: December 7, 2013

Represents the trace listener used for basic Azure logs.

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

public ref class DiagnosticMonitorTraceListener : public TraceListener

The DiagnosticMonitorTraceListener class is used to log trace data for hosted services. All tracing data is stored as a part of 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, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

Community Additions

© 2015 Microsoft