Trace

  • Thread starter Thread starter schoenfeld1
  • Start date Start date
S

schoenfeld1

I can't seem to get Trace to write to a file unless I explicitly call
Trace.Close() at the end of my app. My log files don't flush until I
close this. Is there a way to view the trace output files during
application running without needing to call Trace.Close()?


Or does it auto-flush after a certain threshold is reached?
 
I can't seem to get Trace to write to a file unless I explicitly call
Trace.Close() at the end of my app. My log files don't flush until I
close this. Is there a way to view the trace output files during
application running without needing to call Trace.Close()?


Or does it auto-flush after a certain threshold is reached?

You can use the Trace.Flush() method to flush the data to the listeners.
There's also the AutoFlush property, that will make the Trace objects
flush its data after every Write.

If the data is not flushed (or Close()d, finally), what happens depends
on the implementations of the listeners. Some of them (like the standard
EventLogTraceListener) may not even have the notion of flushing their
data. Others will use the settings of their configured output channels.


Oliver Sturm
 
Back
Top