here is sample code to add trace in application.
<configuration>
<system.diagnostics>
<trace autoflush ="true" indentsize="4">
<listeners>
<add name ="TestListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="application.log" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
</trace>
</system.diagnostics>
</configuration>
use Trace.Write to write into log file.
it will create a log file in application, trace is the easiest why to track the bug/exception in application.
No comments:
Post a Comment