DiagnosticMonitorTraceListener Class
Updated: December 7, 2013
Represents the trace listener used for basic Azure logs.
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)
System::MarshalByRefObject
System.Diagnostics::TraceListener
Microsoft.WindowsAzure.Diagnostics::DiagnosticMonitorTraceListener
Name | Description | |
---|---|---|
![]() | DiagnosticMonitorTraceListener() | Constructor for the DiagnosticMonitorTraceListener class. |
Name | Description | |
---|---|---|
![]() | Attributes | (Inherited from TraceListener.) |
![]() | Filter | (Inherited from TraceListener.) |
![]() | IndentLevel | (Inherited from TraceListener.) |
![]() | IndentSize | (Inherited from TraceListener.) |
![]() | IsThreadSafe | Indicates whether the diagnostic monitor trace listener is thread-safe.(Overrides TraceListener::IsThreadSafe.) |
![]() | Name | (Inherited from TraceListener.) |
![]() | NeedIndent | (Inherited from TraceListener.) |
![]() | TraceOutputOptions | (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:
<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());
![]() |
---|
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. |
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.