Add EventLogTraceListener to Debug.Listener : Debug : Development C# Examples


C# Examples » Development » Debug »

 

Add EventLogTraceListener to Debug.Listener









    
#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();
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Debug