Trace to a file : Trace : Development C# Examples


C# Examples » Development » Trace »

 

Trace to a file









    
using  System;
using  System.IO;
using  System.Diagnostics;

class  MainClass
{
    [STAThread]
    static  void  Main(string[]  args)
    {
        FileStream  Log  =  new  FileStream("Log.txt",  FileMode.OpenOrCreate);

        Trace.Listeners.Add(new  TextWriterTraceListener(Log));
        Trace.WriteLine("My  Trace  String  To  Log  File");
        Trace.Flush();
        Log.Close();
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Trace