2
behind that button only
need to do in order to output a message to the trace is to use the trace object
which is provided by the page object that this class inherits from in order to
implement create an ASP.net page, so we need to do is use either the right or
worn method in order to output some sort of string sets an example of one of
the overloads and then we can also use the second overload to write out both a
category as well as a message then run the application again and I'll click on
this link button and just post back to the page itself.
But now I can scroll down and see that we've
added some additional custom information is the trace right message and the
trace worn message which don't have any category and then here are the second
set of messages that have a category assigned so it's very easy to add
additional information and most often you probably want to categorize it seek
and very quickly go to the specific information about your application because
depending on how your instrument.
Your application with these kinds of
statements it can output an awful lot of data can also create whatever
categories you want so for example maybe different set of methods within your
page have different categories and it's a great way to be able to scan the
information besides the custom trace right and trace worn messages.
The trace information is
a list of trace messages that are generated automatically as the application
executes the messages are grouped into several tables the group specific types
of trace information you can see were ASP.net adds Rose for the events that are
raised during the lifecycle of the page and we saw that in an earlier example.
The page also displays
information about the controls used by the page this is a real handy feature
where you want to look at the characteristics of the controls particularly how
much they are contributing to view state if you have bloated you state trace
makes it very easy to find the offenders you may have one control that doesn't
even need to use the state but is generating a lot of data within.
The state does get
information about any session state variables and cookies that you use their
included within the HTTP request you can examine the various request headers
session variables and on and on as a lot of information there and it's
worthwhile exploring the trace for variety of pages to the get a feel for.
How to best use that? we
really need to use it in order to debug application when you had tracing code
to your own code you can use the trace context.is enabled property in order to
determine whether tracing is enabled before you execute any right or worn
methods this really is a necessary because you turn trace on an offer an entire
page and if tracing is not an enabled any right and worn statements.
0 comments:
Post a Comment