Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trace listener

Status
Not open for further replies.

Quotot

Programmer
Joined
Aug 2, 2006
Messages
1
Location
AU
Does anyone see anything wrong here? I'm trying to set the trace output options to TimeStamp so that my debug messages print out a timestamp along with the message.

here is how I initialise the trace listener.

StreamWriter sw = new StreamWriter System.Windows.Forms.Application.StartupPath + "\\BackupDebug.log", true);
sw.AutoFlush = true;

TextWriterTraceListener textWriter = new TextWriterTraceListener(sw);
textWriter.Name = "OutputDebug";
textWriter.TraceOutputOptions |= TraceOptions.Timestamp;

System.Diagnostics.Debug.Listeners.Add(textWriter);

Then if I make a call to;
System.Diagnostics.Debug.WriteLine("some text");

The text is written to the file "BackupDebug.log" but I get no timestamp with it. I've tried with various other options, but again no luck.

Pete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top