Trace output capturing in a text file.

Hi

In asp.net 2.0 it’s very easy to capture the trace file and keep it in a text file, Xml file or database. ASP.NET 2.0 introduces flexibility to output the trace information. We can also pass the trace output to any data storage we want.

The TraceContext class now features a TraceFinished event that provides programmatic access to trace output. In the page load event we create a handler for the TraceFinished event.

Trace.TraceFinished += new TraceContextEventHandler(OnTraceFinished);

Now we can use this tracefinished event to log the trace data.

 
void OnTraceFinished (object sender, TraceContextEventArgs e)

{

    foreach (TraceContextRecord record in e.TraceRecords)

    {

         //Write To a log File here

     }

}

Hope this helps
Thanks
Vikram


Share this post   Email it |  digg it! |  reddit! |  bookmark it!

Feedback

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 
Copyright © 2006 - 2009 Vikram Lakhotia