Getting More Tracing Output in ASP.NET App.

C

cnys

We have an ASP.NET 2.0 (C#) app and we're trying to add tracing into it.
The tracing functionality within .NET is great, but when we output this to a
file, it's kind of sparse.

So, we're looking for ideas on how to get more tracing info. output to our
log file than what's currently output by calling the Write methods.


Here are some snippets of what we're thinking of:

Web.config
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="TextWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="D:\Temp\TraceFiles\Application_TraceFile.log"/>
</listeners>
</trace>
</system.diagnostics>



..aspx page
protected void Page_Load(object sender, EventArgs e)
{
Trace.Write("Web Application", "Trace test from a web application
(before call to method in class library).");

Tracing.Trace(); // Call to method in library, to get tracing info.
from a library too

Trace.Write("Web Application", "Trace test from a web application
(after call to method in class library).");
}



..cs class library
public static void Trace()
{
// Just for testing tracing from a library and an ASP.NET app
System.Diagnostics.Trace.WriteLine("Trace test from a class
library (using WriteLine).", "Tracing Class Library");
}



In the tracing log file, we get:

aspx.page: Begin PreInit

....

aspx.page: Begin Load
Web Application: Trace test from a web application (before call to method in
class library).
Tracing Class Library: Trace test from a class library (using WriteLine).
WhoAmI Web Application: Trace test from a web application (after call to
method in class library).
aspx.page: End Load

....

aspx.page: End Render



Is there any way to have the built-in tracing spit out more info. to the
file? For example, if you have tracing turned on to display at the bottom
of the web page, it generates a lot of useful info. Is there any way to get
all that info. logged to a file?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,786
Latest member
EmilioGuru

Latest Threads

Top