views:

274

answers:

1

ASP.NET tracing seems very erratic. Sometimes it traces and sometimes it doesn't.

I trace from my ASCX using...

Trace.Write("etc. etc.");

My web.config looks as follows... (in WSS3) I first ensure that SharePoint allows the page level tracing...

<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="true">

Here's my ASP.NET trace element...

<trace enabled="true" localOnly="false" pageOutput="true" writeToDiagnosticsTrace="true" />

And my System.Diagnostics trace...

<system.diagnostics>
<trace autoflush="true" indentsize="4" >
 <listeners>
  <add name="listen" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\asptrace\log.txt" />
  <add name="listen2" type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"  />
 </listeners>
</trace>

Anything obvious I'm missing?

+6  A: 

Have you checked the request limit in your web.config? It's set to 10 by default, which means you'll only get trace output of the first 10 requests after the application starts.

<trace enabled="false" requestLimit="10" />
David Kemp
You might also want to set mostRecent="true"
David Kemp
Excellent advice, thank you!Increasing the RequestLimit solved the problem. Also, I tried using DebugView from sysinternals. Works well too.
willem
Excellent answer, just what I've been looking for! (I used to have the same problem a few days ago) +1
Tom