pusing debug info to a log file

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Is there an easy way to make a copy of all the debug.writeline stuff go to a
log file also? thanks!
 
Hi,


Use trace instead of debug. Add a textwriterlistener to the
trace listeners.

Dim fs As New System.IO.FileStream("C:\Test.txt", IO.FileMode.Append)

Dim myTextListener As New TextWriterTraceListener(fs)



Trace.Listeners.Add(myTextListener)

Dim environmentVariables As IDictionary =
Environment.GetEnvironmentVariables()

Dim de As DictionaryEntry

For Each de In environmentVariables

Trace.WriteLine(String.Format(" {0} = {1}", de.Key, de.Value))

Next de



Ken
 
Back
Top