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 class DiagnosticMonitorTraceListener : 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:

<system.diagnostics>
   <trace>
      <listeners>
         <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, 
            Microsoft.WindowsAzure.Diagnostics, 
            Version=1.0.0.0, 
            Culture=neutral, 
            PublicKeyToken=31bf3856ad364e35"
            name="AzureDiagnostics">
            <filter type="" />
         </add>
      </listeners>
   </trace>
</system.diagnostics>

To enable tracing programmatically

Add the following line of code:

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

System.Object
   System.MarshalByRefObject
     System.Diagnostics.TraceListener
      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

ADD
Show:
© 2014 Microsoft