Debugging is essential and useful for every software development process and software application. Diagnosing a software application and locating and fixing bugs and problems is even more complex when in a production environment where the application project is directly deployed in release mode. In addition to debugging, you need to use instrumentation practices to ensure the expected performance of your application. Instrumentation is basically monitoring and measuring performance, diagnosing errors, and writing trace information both in development and production environments.
In this article, you will learn how to enable instrumentation for your application - both debugging and tracing.
The Debug and Trace classes are part of the System.Diagnostics namespace in .NET framework.
For more information see:
Following is a sample code that demonstrates how to indicate that your application has initiated and is monitored using the Debug and Trace classes:
The code above demonstrates the debug information by the Output window in Visual Studio in development environment. However, you cannot view tracing information when your project is in development mode.
To view tracing information using one of these methods in production environment:
There are various types of listeners that you can use – text file listener, event viewer, and others. In Sitefinity CMS, you can create custom trace listeners. For a detailed tutorial, see Create and enable a custom trace listener.
In general, however, there is too much noise and you hardly filter to use the information that you actually need. If you want to filter the ASP.NET events and eliminate the events and messages that are not of interest to you, you must add a trace source. You write the messages that are important for your log on the trace source and the source redirects the messages to the trace listeners. The following code demonstrates how to send messages to the trace source:
NOTE: You need to import the System.Diagnostics namespace.
The trace source controls by switches the messages, emitted by ASP.NET, and sends them to various sources, such as files, the event viewer, XML files, and so on.
You can use the ActivityId property to group by correlation the errors, thrown during the execution of one and the same request. Since correlation ActivityId is set per request, all errors thrown during one request are with the same ActivityId.
Following are a few examples when you can use grouping of errors in a request:
For more information, see:
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2023 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity