Hade du nytta av den här sidan?
Din feedback om det här innehållet är viktig. Berätta vad du tycker.
Ytterligare feedback?
1500 tecken kvar
Trace the Flow of Your Azure Application
Det här innehållet finns inte tillgängligt på ditt språk men här finns den engelska versionen,

Trace the Flow of Your Azure Application

Updated: July 16, 2015

Tracing is a way for you to monitor the execution of your application while it is running. You can use the System.Diagnostics.Trace, System.Diagnostics.Debug, and System.Diagnostics.TraceSource classes to record information about errors and application execution in logs, text files, or other devices for later analysis. For more information about tracing, see Tracing and Instrumenting Applications.

You implement tracing in your Windows Azure application by adding the DiagnosticMonitorTraceListener to the configuration of the application and adding calls to System.Diagnostics.Trace or System.Diagnostics.Debug to your application code. The configuration file that you use is either the app.config file (for worker roles) or the web.config file (for web roles). When you create a new hosted service in Visual Studio by using the provided template, Windows Azure Diagnostics is already added to the project and the DiagnosticMonitorTraceListener is added to the appropriate configuration file for the roles that you add.

You must exercise special care when placing your trace statements for use during run time. You must consider what tracing information is likely to be needed in a deployed application, so that all likely tracing scenarios are adequately covered. Because applications that use tracing vary widely, however, there are no general guidelines for strategic placement of tracing. For more information on placing trace statements, see How to: Add Trace Statements to Application Code.

By placing Trace Switches in your code, you can control whether tracing occurs and how extensive it is. This lets you monitor the status of your application in a production environment. This is especially important in a business application that uses multiple components running on multiple computers. For more information, see How to: Configure Trace Switches.

See Also

© 2015 Microsoft