new TextWriterTraceListener(String fileName) : TextWriterTraceListener « System.Diagnostics « C# / C Sharp by API






new TextWriterTraceListener(String fileName)

  

#define DEBUG

using System;
using System.Globalization;
using System.Diagnostics;

class MainClass
{
  public static void Main() 
  {
    TextWriterTraceListener tl = new TextWriterTraceListener("Example21_12.txt");
    Debug.Listeners.Add(tl);
    
    EventLogTraceListener t2 = new EventLogTraceListener("Application");
    Debug.Listeners.Add(t2);

    Debug.WriteLine("Starting Main()");
    Debug.Assert(1 == 2, "1 ==2");

    Debug.WriteLine("Exiting Main()");
    Debug.Flush();
    Debug.Close();
  }
}

   
    
  








Related examples in the same category