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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top