×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

[Q]TextWriterTraceListener does not work under asp.net 2.0

C# code:

Trace.Writeline("hello") does not complain but does not create C:\xxx.log file.
The same code was working on asp.net 1.1 and is working on regular application on
framework 2.0. But it does not work on asp.net and webservice/framework 2.0.

I guess it may associate with security since asp application is using different context
from that of regular window/console application.

Any advice is appreciated.


_______________web.config____________________

<system.web>
<trace enabled="true" pageOutput="true" localOnly="true" writeToDiagnosticsTrace ="true"/>
</system.web>

<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="xxxxx" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\xxx.log" />
<remove name="Default"/>
</listeners>
</trace>
</system.diagnostics>
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / [Q]TextWriterTraceListener does not work under asp.net 2.0
    C# code:

    Trace.Writeline("hello") does not complain but does not create C:\xxx.log file.
    The same code was working on asp.net 1.1 and is working on regular application on
    framework 2.0. But it does not work on asp.net and webservice/framework 2.0.

    I guess it may associate with security since asp application is using different context
    from that of regular window/console application.

    Any advice is appreciated.


    _______________web.config____________________

    <system.web>
    <trace enabled="true" pageOutput="true" localOnly="true" writeToDiagnosticsTrace ="true"/>
    </system.web>

    <system.diagnostics>
    <trace autoflush="true" indentsize="4">
    <listeners>
    <add name="xxxxx" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\xxx.log" />
    <remove name="Default"/>
    </listeners>
    </trace>
    </system.diagnostics>
    • up