开发者

How to send the tracing output to a file in the file system?

开发者 https://www.devze.com 2023-01-07 16:50 出处:网络
I have added the following code to my web.config file: <system.diagnostics> <trace autoflush=\"false\" indentsize=\"4\" >

I have added the following code to my web.config file:

<system.diagnostics>
    <trace autoflush="false" indentsize="4" >
      <listeners>
        <add name="myListener"
          type="System.Diagnostics.TextWriterTraceListener"
          initiali开发者_JAVA技巧zeData="d:\debugging.txt" />
        <remove name="Default"></remove>
      </listeners>
    </trace>
  </system.diagnostics>

And I have written this line for sending trace output:

System.Diagnostics.Trace.Write(sID + " tracing id");

But, I can not see any "debugging.txt" file created on my d: drive and there is no trace output.

Am I missing something ?


You need to trace to a directory that the ASP.NET service has write permission on.

What I like to do is just leave the default listener and run TechNet DebugView, which has the option of saving or logging to a file.

0

精彩评论

暂无评论...
验证码 换一张
取 消