System.Diagnostics.Trace.Write() doesn't work in ASP.NET apps

O

Oleg Ogurok

Hi there,

My ASP.NET 2.0 app uses an external assembly that calls methods like
Trace.Write() and Trace.TraceError() of namespace System.Diagnostics.
I need to enable tracing in my web app so that I could see the trace
messages from the component.

Here's what I've added to web.config so far:

<system.web>
<trace writeToDiagnosticsTrace="true"/>
......
</system.web>


<system.diagnostics>
<switches>
<add name="GS.Pwm.Crm" value="4"/>
<add name="Test Log" value="4"/>
</switches>
<trace autoflush="true">
<listeners>
<add name="WebPageTraceListener"
type="System.Web.WebPageTraceListener,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
<add name="Test Log"
type="System.Diagnostics.TextWriterTraceListener,
System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" traceOutputOptions="Callstack"
initializeData="C:\test\test.log" />
<add name="GS.Pwm.Crm"
type="System.Diagnostics.EventLogTraceListener,
System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
initializeData="Application" />
</listeners>
</trace>
</system.diagnostics>


If I look into c:\test\test.log or the event log, I'll see the standard
ASP.NET trace messages, e.g.

aspx.page: Begin PreInit
aspx.page: End PreInit
aspx.page: Begin Init


However, there is no output from any Trace.Write() methods.
Even if I put a Trace.Write inside Page_Load() of one of my pages, it
has no effect.

Your help is greatly appreciated.

-Oleg.
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top