3
Have in your code will do nothing that is
basically ignored because tracing is not enabled the trace context class has a
couple of properties is enabled and trace mode that you can use to enable tracing
programmatically and control the way output is displayed here is where.
You can start to see that once again
ASP.net the.net framework provide you a lot of flexibility in order to use a
particular feature so that is enabled property is a Boolean property that turns
tracing on and off you can check to see whether not tracing is enabled but you
can also turn it on based on various conditions as your application.
Run in the trace mode property S3
enumeration values that control the sort order of the trace output the default
is sort by time to the get a chronological view of what's happening within the
page but you can also sort by category so if you're using categories and you
have a lot of different categories that you're using in order to segregate the
information to different parts of your application any concert by category and
then the default enumeration is the third and that basically just use a sort by
time slots.
Look at how you can use programmatic page
tracing? using these objects once again in the code file behind the
default.aspx page that another link button on the form called code tracing this
is the click event procedure for that button the first thing the code does is
it sets the is enabled property to true and this turns on tracing and then I
want to specify that the results should be sorted by category so I assign the
sort by category enumeration to the trace mode property of the trace object.
And then I write out a trace message for
run the demo to come over here and get rid of the trace equals true because I'm
in a control everything programmatically in this demo salsa thing and they'll
run the application is first of all that I have no trace information I can even
scroll down this is the sum total of the page that appears on click on this
link which turns on tracing programmatically for this post back and I can see
that I have tracing even though tracing was not enabled within the page
directive and can see that my trace information is now sorted by category.
So my custom message here which had no
category assigned to it floats to the top because it didn't have a category to
the shows how you have a lot of flexibility and control in how you implement
tracing and you're not limited to an all or nothing tracing for particular page
you can turn it on or off based on various conditions such as perhaps maybe an
exception occurs page level tracing is not practical after deployment because
enabling tracing requires modifying each page so you can enable tracing for the
entire application by configuring.
0 comments:
Post a Comment