470,626 Members | 2,139 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,626 developers. It's quick & easy.

Getting More Tracing Output in ASP.NET App.

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_Tra ceFile.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.

May 11 '06 #1
0 1240

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Richard | last post: by
2 posts views Thread by Damon Allison | last post: by
6 posts views Thread by serge calderara | last post: by
2 posts views Thread by deepukutty | last post: by
1 post views Thread by Massimo | last post: by
3 posts views Thread by asapjim | last post: by
6 posts views Thread by Stephen Torri | last post: by
1 post views Thread by RedLars | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.