I am trying to write some messages to a text file using Debug.WriteLine(“Message”).
Here is the code.
Dim Tr As TextWriterTraceListener
Tr = New TextWriterTraceListener(System.IO.File.CreateText("Output1.txt"))
'Tr = New TextWriterTraceListener(System.Console.Out)
Debug.Listeners.Add(Tr)
Debug.WriteLine("Test Message")
I see the output1.txt file being created, but nothing is being written in the file.
How can I fix this problem?
The
TextWriterTraceListenerbuffers data and only writes it when the buffer is full, it is closed/disposed, orFlush()is called: