Can enable tracing for specific pages via @ Page directive:
<@ Page trace="true" %&>
Can view on each webpage or the entire log at the http://server/application/trace.axd page.
Displaying trace on individual pages can be a security loophole - disable on production environments.
Use Trace class to add own trace messages.
Member of the Page object
Use Write method to add entries to trace log.
No server process on which to rely, instead have to debug code as executes in browser.
Microsoft AJAX library provides Sys.Debug client-side namespace, includes assert, trace, clearTrace, traceDump and fail methods.
Provides info on overall application health.
Set of classes in System.Web.Management used for health tracking.
Work by raising and logging events.
Enable individual events based on what aspects of application are to be monitored.
First step is to determine which events to listen for. Events are defined as classes. The classes based on hierarchy that defines data to be logged.
Can derive your own classes from these to write custom health monitoring.
|WebBaseEvent||Base class for web events|
|WebManagementEvent||Web events that contain application process information|
|WebHeartbeatEvent||Periodic event raising info about app at set intervals|
|WebRequestEvent||Contains web request info|
|WebApplicationLifetimeEvent||Raised when significant event occurs, e.g. start or shutdown|
|WebBaseErrorEvent||Error based events|
|WebErrorEvent||Provides info on error when occurs|
|WebRequestErrorEvent||Request data for request errors|
|WebAuditEvent||Creates audit (Security) events|
|WebSuccessAuditEvent||Raised when successful security operation occurs|
|WebAuthenticationSuccessAuditEvent||Provides info when successful user authentication occurs|
|WebFailureAuditEvent||Raised when failed security operation occurs|
|WebAuthenticationFailureAuditEvent||Raised when failed attempt at user authentication occurs|
|WebViewStateFailureAuditEvent||Raised when view state fails to load|
When no which events to listen for, enable a listener.
ASP.NET provides set of listeners used to collect web event information.
Can write own custom listeners by extending existing WebEventProvider class.
Turn on web events and connect to listeners via web.config
<healthMonitoring> contains heartBeatInterval which indicates number of seconds between raising WebHeartbeatEvent events.
Individual events contain minInterval attribute (works in similar fashion to heartBeatInterval).
To configure event and provider:
Don't need to register default web events and providers - done in servers configuration file. Only need to add rules to apps Web.config to turn these on. Note, need to know configured name of event class:
<healthMonitoring enabled="true" heartbeatInterval="1">
<add name="Heart Beat" eventName="Heartbeats" provider="EventLogProvider" profile="Default" />