Clever Use: Debug Trace Output

Source: Internet
Author: User

(1 ). note
many people generally use respone when debugging input. write (), or trace and then calculate the object Value in the Command window.
In fact, Microsoft provides a good output debugging class trace for Asp.net. here we will talk about its usage
(2) specific usage

page-level debugging and application Program -level tracing debugging:
1. page-level tracing: The following page commands are included at the beginning of the page: <% @ page trace = "true" tracemode = "sortbycategory/sortbytime" %>
I. sample custom message:
trace. write ("here is the variable or custom string for the output result");
trace. warn ("here is the string to be displayed"); // with trace. write is the same, but the font is red
check whether a trail is used
II. determine whether trace output is Enabled:
If (trace. isenabled) {trace. warn ("tracking enabled")}

2. Application-level tracking:
In the <system. Web> section of the web. config file, <trace enabled = "true" pageoutput = "true"/>
In this way, you do not need to set one page.

The biggest advantage of tracing debugging is that after a programmer is used up, the page or application tracing can be set to false.

You do not need to delete or annotate it because the compiler compiles it to the trace output.
Statement, it will not be compiled, it will skip the trace statement to continue to compile the following statement.

From the programmer's point of view, trace is equivalent to commented out

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.