SALES: 1-800-867-1380

Configure the TraceListener in an Azure Application

Updated: July 15, 2015

When using Trace, Debug and TraceSource, you must have a mechanism for collecting and recording the messages that are sent. Trace messages are received by listeners. The purpose of a listener is to collect, store, and route tracing messages. Listeners direct the tracing output to an appropriate target, such as a log, window, or text file. For Windows Azure Diagnostics, the DiagnosticMonitorTraceListener class is used. Before you complete the following procedure, you must initialize the Windows Azure diagnostic monitor. To do this, see Enabling Diagnostics in Windows Azure.

If you use the templates that are provided by Visual Studio, the configuration of the listener has been added for you.

  1. Open the web.config or app.config file for your role.

  2. Add the following code to the file:

             <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, 
                <filter type="" />
  3. Save the file.

For more information about listeners, see Trace Listeners.

After you complete the steps to add the listener, you can add trace statements to your code. To do this, see Use Trace Messages in an Azure Application.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft