Geeks With Blogs
The life and times of this developer... WPF, C#, XML and other stuff

Hi, it's really handy to be able to add Trace to your .Net application using the System.Diagnostics.Trace class.

The only problem is how the heck do you get it to Trace out at runtime?

The simple solution is to add this to your app config file...

  <system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <clear/>
        <add name="textwriterListener" type="System.Diagnostics.TextWriterTraceListener"
          initializeData="c:\temp\outfile.txt" traceOutputOptions="ProcessId, DateTime"/>
      </listeners>
    </trace>
  </system.diagnostics>

#

 

Posted on Tuesday, January 31, 2012 9:54 AM | Back to top


Comments on this post: Simple Trace from .Net

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © bconlon | Powered by: GeeksWithBlogs.net | Join free