Introduction
ASP.net web events provide a framework
that you can plug into in order to monitor your applications help this is
another example where ASP.net uses a feature internally and exposes the
infrastructure to developers you can use when advanced report on the health of
a website and audit you can even develop and race custom events to monitor the
things that are important to administrators determine which events.
They are
interested in by using event subscriptions that are controlled by configuration
files which can also specify channels through which the events are delivered
out of the box channel providers handle saving events to SQL Server sending
event reports through email writing events to the event log and forwarding
events through Windows management instrumentation.
Health Monitoring : 1
You had to accept the
default rendering and it wasn't easy to redirect output to a persistent store
but now ASP.net provides programmatic access to trace output through the
system.Web.trace context object using the trace finished event you can hook
into trace finished and do whatever you want with the output the trace finished
event exposes trace messages as a collection of trace context record objects
after all the request information is been gathered by registering a trace
context event handler delegate you can iterate through the trace messages.
And
write them to response stream a trace context record object encapsulates the
trace message category any associated exception and whether the trace record
was written by the trace context.warn method in a several properties he can
take advantage of the category property gets the user-defined type category for
the trace record so like other trace information you can categorize the
information that your gathering error info gets an exception if one is
associated with the trace record is warning its a value indicating whether the
trace record is associated with the trace context.warn method call and finally
the message property gets the user-defined.
Trace message that's associated with
the object classical look at how you can take advantage of the trace context
record object this example shows how to register a trace context event handler
to handle the trace finished event this is the code behind the trace
context.aspx page in the page load event procedure we have to add a handler for
the traced finished event and so forth that we just pass in the address of the
on traced finish method and then we go ahead and write some custom information
the first thing that the page load event procedure does is it adds a handler to
the trace finished .
Event and we pass in the address of the entrees finished
method and write out a message to the trace object appears that entrees
finished method like pretty much all events within the.net framework he gets a
couple of parameters against the Senators object to identify what caused this
event or more portly for a purpose here we get this trace context event arcs
parameter and this contains a collection of trace records.
thank you good work
ReplyDelete