Tuesday, March 29, 2011
Thursday, March 24, 2011
simple logger code in C#
using System.Diagnostics;
TraceListener logger;
string LogFile = ClientClaimsLoad.Properties.Settings.Default.LogFile;
logger = new TextWriterTraceListener(LogFile);
Trace.Listeners.Add(logger);
Trace.WriteLine("Process started at " + DateTime.Now.ToString());
Trace.Flush();
Trace.Listeners.Remove(logger);
logger = null;
Trace.Write("Process ends at {0}\r\n", DateTime.Now.ToString());
TraceListener logger;
string LogFile = ClientClaimsLoad.Properties.Settings.Default.LogFile;
logger = new TextWriterTraceListener(LogFile);
Trace.Listeners.Add(logger);
Trace.WriteLine("Process started at " + DateTime.Now.ToString());
Trace.Flush();
Trace.Listeners.Remove(logger);
logger = null;
Trace.Write("Process ends at {0}\r\n", DateTime.Now.ToString());
Subscribe to:
Posts (Atom)