asp.net application-level tracking

Source: Internet
Author: User
Tags config modify opening and closing tags root directory
Asp.net| Program

The

   can enable tracing for an entire application in the Web.config file in the application's root directory. By default, application-level tracing can only be viewed on the local WEB server computer. You must
  
   set Localonly to False in the Web.config file so that application-level trace information can be seen from the remote computer.
  
   To disable remote tracing, set the Localonly property to true in the Web.config file. The following example shows an application trace configuration that collects trace information for up to 40
  
   requests and allows browsers on computers other than the original server to display the trace viewer.
  <configuration>
   <system.web>
   <trace enabled= "true" requestlimit= "localonly=" "false"/>
   </system.web>
  </configuration >
   When you enable tracing for an application, asp.net collects trace information for each request to the application (up to the maximum number of requests you specify). The default number of requests is 10. When the trace views the
  
   reaches its request limit, the application stops storing trace requests.
  
   Note When you enable tracing for an entire application in the Web.config file, trace information is collected and processed for each page in the application. To disable tracing for a specific page in your application,
  
   Set the trace property to False in the @ Page directive of the page. Any tracecontext.write or TraceContext.Warn statements that you include in the page code will be stored, and
  
&Nbsp;  and they are returned only to the trace viewer.
   If you want the trace information to be attached to the end of the page associated with it, set the Pageoutput property to true in the Tracking configuration section of the Web.config file. Set this property to False if you want the tracking information to appear only in the
  
   trace Viewer. If you enable application-level tracing but do not want to display trace information for some pages of the application, use the @ Page directive to set the trace property of the page that does not want to display
  
   trace information to false.
  
   Below are all the properties that you can use to modify application-level trace behavior.
  
   Property Description
  enabled True if application-level tracing is enabled, otherwise false. The default value is False.
  pageoutput True if trace information is displayed both on the Application page and on the. Axd Tracing utility; The default value is False.
   Note pages that are enabled for tracing are not affected by this setting.
The number of trace requests stored on the   requestlimit server. The default value is 10. The
  tracemode indicates whether the trace information is displayed in the order in which they are processed (sortbytime) or in alphabetical order (sortbycategory) of the user-defined category. The default value is
  
  sortbytime.
  localonly True if the trace viewer (Trace.axd) is only available on the host Web server; The default value is true.

Enable application-level tracing


  


If you haven't done so yet, create a text file, name it web.config, and save it to the application's root directory.


adds the start and end tags of &lt;system.web&gt; elements between the opening and closing tags of the &lt;configuration&gt; element.


between the &lt;system.web&gt; element tags, add the &lt;trace&gt; element (it is from the end).


in the &lt;trace&gt; element, declare the Enabled property and set it to true.


declare other optional properties and modify the tracking behavior of the application as you want.


For example, the following application trace configuration collects trace information for up to 40 requests and allows browsers to display the trace viewer on computers other than the original server.


&lt;configuration&gt;


&lt;system.web&gt;


&lt;trace enabled= "true" requestlimit= "M" localonly= "false"/&gt;


&lt;/system.web&gt;


&lt;/configuration&gt;


Note that the ASP.net configuration system is case-sensitive. All individual word configuration sections are lowercase, and two-word-concatenated sections or attributes must be Camel case. For example,


  


Requestlimit is a valid property name, while requestlimit causes a parser error.


View trace information with the trace viewer


once application-level tracing is enabled, it executes any trace statements that are included when requesting each page in the application. By requesting the Trace.axd in the application's root directory, you can follow the


  

View these statements and other trace information in the
Tracer Viewer.


  


Note When application-level tracing is enabled, you can view trace statements and their
in any page of the application by setting the Pageoutput property to true in the Web.config file

  


his message.

The
Trace Viewer allows you to select a specific request in a page that has been requested from the application. The following screenshot shows a trace viewer that has 7
that should be turned on after tracing

  


request with a program.


  


Trace Viewer


  


if more than one request arrives for an application that has tracing enabled, the trace viewer lists them in the order in which they are processed. The information on the start page of the trace Viewer includes: The requested time, request


  

The
file, the requested status code, the HTTP predicate associated with the request, and the View Details link that allows you to view more details about the request. The number of requests displayed will not be


  


The requestlimit setting that you specified in the Web.config file is exceeded.


  


View trace details for a particular request


  


navigates to the trace viewer associated with your application.


For example, if your application's URL is http://localhost/myapplication, navigate to Http://localhost/myapplication/trace.axd to see the application's


  


Tracer statistic information.


  


Select the "View Details" link for the request you want to study.


When you select View details, you will see the same information as the page appended to the enabled trace.


  


In some cases, you may want to remove all requests that are stored in the trace viewer. Maybe you want to track changes made to files in your application, or just want to see the requests that are currently displayed


  


information about files that are not associated with the file.


  


clears the request from the trace viewer


  


navigates to the trace viewer associated with the application.


selects the "Clear current trace" link to remove all requests stored in the trace viewer application.


Note the trace viewer only tracks requests that are made after the record is purged. You cannot view requests that were made before the request limit was reached and when the record was purged.







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.