
228
|
Chapter 10: Error Handling, Debugging, and Tracing
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
In addition to providing a single point of control over enabling/disabling tracing,
the
<trace> element allows you to control several other factors: whether trace
output is visible to machines other than the local host (using the
localOnly
attribute); whether the output is sent to the page or to a trace log (using the
pageOutput attribute); the number of traces that are kept in the trace log
(
requestLimit); and how the Trace Information section of the trace output is
sorted (
traceMode).
If
pageOutput is set to False, you can still view the trace output by entering the
special URL Trace.axd (which isn’t an actual file, but a URL that invokes an
HttpHandler for the trace functionality) from the root of the application. Trace.axd
lists all saved traces for the application. Note that once the number of traces speci-
fied by the
requestLimit attribute is met, no more traces are saved until the trace
log is cleared. Trace.axd provides a link for this purpose.
Using Trace.Write and Trace.Warn
Finally, as mentioned in the introduction to this section, instead of using
Response.Write (as done in classic ASP) to write out variable values or flag certain
points in your code, ASP.NET enables you to use Trace.Write and Trace.Warn.
Both the Write