Tracing To EventLog : Trace « Development « C# / CSharp Tutorial






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

class MainClass
{
  [STAThread]
  static void Main(string[] args)
  {
    //You can change the listener with the following code
    EventLogTraceListener EventListener = new EventLogTraceListener("MyApp");

    Trace.Listeners.Add(EventListener);
    
    Trace.WriteLine("My Trace String To Console");

    
    }
}








14.28.Trace
14.28.1.Tracing To Debugger
14.28.2.Trace Assert
14.28.3.Trace to console
14.28.4.Trace to a file
14.28.5.Tracing To EventLog
14.28.6.Use Trace Switch
14.28.7.Use Trace Switch defined in config file