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"
initializeData="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 ?
Most trace sources generate packetized data that might be further formatted by the trace infrastructure. This means that the captured trace data is not in a human-readable format. The trace data must go through extraction, decompression, decode, and processing stages to become human-readable.
Look at the "Output" Tab ( View | Output , or Ctrl + Alt + O ) in Visual Studio. If it's not outputting there, you need to add a listener. Check this documentation. Note: For most projects the compiler flag TRACE should be on by default in Visual Studio.
WriteLine(String) Writes a message to the trace listeners in the Listeners collection.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With