S
Simon
Hi all,
I'm trying to use the Trace class to log messages to a simple text file.
I need to be able to provide a custom filename to be used. I've created
a TextWriterTraceListener and added it to the Trace.Listeners
collections but nothing ever seems to get written to the file.
The file does get created, but calling the Write methods doesn't seem to
do anything.
Can anyone tell me why the code below shouldn't work?
TextWriterTraceListener textListener = new
TextWriterTraceListener("Hello.txt");
Trace.Listeners.Add(textListener);
// Doesn't Work
Trace.WriteLine("Hello World");
// Doesn't Work
textListener.WriteLine("Hello World");
Many thanks all
Simon
I'm trying to use the Trace class to log messages to a simple text file.
I need to be able to provide a custom filename to be used. I've created
a TextWriterTraceListener and added it to the Trace.Listeners
collections but nothing ever seems to get written to the file.
The file does get created, but calling the Write methods doesn't seem to
do anything.
Can anyone tell me why the code below shouldn't work?
TextWriterTraceListener textListener = new
TextWriterTraceListener("Hello.txt");
Trace.Listeners.Add(textListener);
// Doesn't Work
Trace.WriteLine("Hello World");
// Doesn't Work
textListener.WriteLine("Hello World");
Many thanks all
Simon