S
Stewart Berman
I want to write trace out to a file instead of the default. If I define a trace listener and add it
to the tracelisteners collection the debug output goes there as well.
I tried:
Private myTextWriterTraceListener As TextWriterTraceListener
myTextWriterTraceListener = New TextWriterTraceListener(System.IO.File.CreateText(Trace.txt")
and then
replaced
Trace.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.Name)
Trace.Flush()
Trace.Indent()
with
my.TextWriterTraceListener.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.Name)
myTextWriterTraceListener.Flush()
myTextWriterTraceListener.Indent()
but the last statement won't compile as Indent is not a method of the TextWriterTraceListener class.
Is there someone to use the Trace class without sharing listeners with the Debug class or do I have
to write a custom class to wrap the TextWriterTraceListener class and add an Indent method?
to the tracelisteners collection the debug output goes there as well.
I tried:
Private myTextWriterTraceListener As TextWriterTraceListener
myTextWriterTraceListener = New TextWriterTraceListener(System.IO.File.CreateText(Trace.txt")
and then
replaced
Trace.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.Name)
Trace.Flush()
Trace.Indent()
with
my.TextWriterTraceListener.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.Name)
myTextWriterTraceListener.Flush()
myTextWriterTraceListener.Indent()
but the last statement won't compile as Indent is not a method of the TextWriterTraceListener class.
Is there someone to use the Trace class without sharing listeners with the Debug class or do I have
to write a custom class to wrap the TextWriterTraceListener class and add an Indent method?