DiagnosticMonitorTraceListener Class


Represents the trace listener used for basic Azure logs.

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

Inheritance Hierarchy



public class DiagnosticMonitorTraceListener : TraceListener
public ref class DiagnosticMonitorTraceListener : TraceListener
type DiagnosticMonitorTraceListener = 
        inherit TraceListener
Public Class DiagnosticMonitorTraceListener
    Inherits TraceListener


Name Description
System_CAPS_pubmethod DiagnosticMonitorTraceListener()

Constructor for the DiagnosticMonitorTraceListener class.


Name Description
System_CAPS_pubproperty Attributes

(Inherited from TraceListener.)

System_CAPS_pubproperty Filter

(Inherited from TraceListener.)

System_CAPS_pubproperty IndentLevel

(Inherited from TraceListener.)

System_CAPS_pubproperty IndentSize

(Inherited from TraceListener.)

System_CAPS_pubproperty IsThreadSafe

Indicates whether the diagnostic monitor trace listener is thread-safe.(Overrides TraceListener.IsThreadSafe.)

System_CAPS_pubproperty Name

(Inherited from TraceListener.)

System_CAPS_protproperty NeedIndent

(Inherited from TraceListener.)

System_CAPS_pubproperty TraceOutputOptions

(Inherited from TraceListener.)


Name Description
System_CAPS_pubmethod Close()

(Inherited from TraceListener.)

System_CAPS_pubmethod CreateObjRef(Type)

(Inherited from MarshalByRefObject.)

System_CAPS_pubmethod Dispose()

(Inherited from TraceListener.)

System_CAPS_protmethod Dispose(Boolean)

Releases the unmanaged resources used by the TraceListener and optionally releases the managed resources.(Overrides TraceListener.Dispose(Boolean).)

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod Fail(String)

(Inherited from TraceListener.)

System_CAPS_pubmethod Fail(String, String)

(Inherited from TraceListener.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod Flush()

(Inherited from TraceListener.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetLifetimeService()

(Inherited from MarshalByRefObject.)

System_CAPS_protmethod GetSupportedAttributes()

(Inherited from TraceListener.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod InitializeLifetimeService()

(Inherited from MarshalByRefObject.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone(Boolean)

(Inherited from MarshalByRefObject.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

System_CAPS_pubmethod TraceData(TraceEventCache, String, TraceEventType, Int32, Object)

Writes trace information, a data object and event information to the listener-specific output.(Overrides TraceListener.TraceData(TraceEventCache, String, TraceEventType, Int32, Object).)

System_CAPS_pubmethod TraceData(TraceEventCache, String, TraceEventType, Int32, Object[])

Writes trace information, an array of data objects and event information to the listener-specific output.(Overrides TraceListener.TraceData(TraceEventCache, String, TraceEventType, Int32, Object[]).)

System_CAPS_pubmethod TraceEvent(TraceEventCache, String, TraceEventType, Int32)

Writes trace and event information to the listener-specific output.(Overrides TraceListener.TraceEvent(TraceEventCache, String, TraceEventType, Int32).)

System_CAPS_pubmethod TraceEvent(TraceEventCache, String, TraceEventType, Int32, String)

Writes trace information, a message, and event information to the listener-specific output.(Overrides TraceListener.TraceEvent(TraceEventCache, String, TraceEventType, Int32, String).)

System_CAPS_pubmethod TraceEvent(TraceEventCache, String, TraceEventType, Int32, String, Object[])

Writes trace information, a formatted array of objects and event information to the listener-specific output.(Overrides TraceListener.TraceEvent(TraceEventCache, String, TraceEventType, Int32, String, Object[]).)

System_CAPS_pubmethod TraceTransfer(TraceEventCache, String, Int32, String, Guid)

(Inherited from TraceListener.)

System_CAPS_pubmethod Write(Object)

(Inherited from TraceListener.)

System_CAPS_pubmethod Write(Object, String)

(Inherited from TraceListener.)

System_CAPS_pubmethod Write(String)

When overridden in a derived class, writes the specified message to the listener you create in the derived class.(Overrides TraceListener.Write(String).)

System_CAPS_pubmethod Write(String, String)

(Inherited from TraceListener.)

System_CAPS_protmethod WriteIndent()

(Inherited from TraceListener.)

System_CAPS_pubmethod WriteLine(Object)

(Inherited from TraceListener.)

System_CAPS_pubmethod WriteLine(Object, String)

(Inherited from TraceListener.)

System_CAPS_pubmethod WriteLine(String)

When overridden in a derived class, writes a message to the listener you create in the derived class, followed by a line terminator.(Overrides TraceListener.WriteLine(String).)

System_CAPS_pubmethod WriteLine(String, String)

(Inherited from 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());


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.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.WindowsAzure.Diagnostics Namespace

Return to top