Programmatic access to trace output from System.Web.TraceContext, using the TraceFinished event.
TraceContextRecord encapsulates a trace message, it can be put in CAtegory, ErrorInfo gets an exception, IsWarning indicates if it's a warning.
One has to attach en avent heandler to the Trace.TraceFinihsed += new TraceContextEventHandler(ONTraceFinished);
This handler recieves within it's event args a collection TraceContextRecord.
It can be used to log events on a sql server database.
First requires to run Aspnet_regsql.exe utility to create the db that will be used by listeners, Confiure SQL server for application Services, pick an instance to host on, you get a summary, and it will take care of confuring the database, now it's set to save health info on this db.
In the web.config, a healthMonitoring element needs to be added within the system.web eleement, by specifiying the provider, it's type, connection string, and then rules for which events to log, and EventMappings from the root Web.config file.
Comments
Post a Comment