Introduction
Are you know what you deploy an application it becomes hard
to test not least because users get grouchy when an application is off-line for
a few hours while developers have to debug problem that's what instrumenting
application can save the day kind of like letting you debug by proxy when the
instrument code you placed trace statements at strategic locations in your code
that describe events of interest then tools and.net gather the data you
generate and traces the call listeners and you can debug monitor performance
fine-tune the application best of all you can modify the tracing declaratively
without touching the code is another way that ASP.net does magic.
Listeners : 1
System.diagnostics.trace output is collected by objects called
listeners the trace listener is an object that receives trace output and writes
it out you could write it out to almost anywhere you want it to be a device
such as a text file to ASP.net to some sort of external monitoring system or to
a database or wherever you want to collect this output when the trace listeners
created is typically added to the trace.listeners collection which lets the
listener receive all trace output including ASP.net and that's what you can
control the output that ASP.net receives using the right to diagnostics trace
setting within web.config missing about this is that you can define as many
listeners or as few listeners as you want to use and you can also customize
which listeners get which information using some of the techniques are really
talk about now all listeners are derived from the abstract trace listener class
which has a variety of methods functionality of each trace listeners.
The same
the difference is the target media for the tracing output which is determined
by the individual trace listeners that just means that you can have the output
go to various listeners each of which save the data to its own output media
text file email whatever is appropriate for that listener the first method is
fail this outputs the specified text with the call stack next method is right
which outputs the specified text right line outputs the specified text as well
as a carriage return is handy for listeners such as text files where you want
to separate the different messages with a carriage return flush flushes the
output buffer to the target media and then close closes the output stream in
order to stop receiving the tracing and debugging output is a how to use some
of these methods global later in an example Visual Studio comes with several
predefined listeners that are implemented as classes the default trace listener
admits rights and right line messages to the output debug string and to the
debugger.log method in Visual Studio.net if you're running the code there that
means that the messages are going to appear in the output window and that's why
in an earlier example the messages went to the output window we could view of
their.

0 comments:
Post a Comment