0

If using auto flush, or flushing manually on each write of message, I noticed something while debugging in Visual studio, I don't see the data written to file even though I enable AutoFlush = true. The file only gets updated when I stop the debugger. This led me to believe that the data is only being flushed at certain time, or when the program comes to completion.

Or is this a side effect of debugging and in the actual program it will behave differently?

At what point will data get written? Right away, or after some event, or time?

EDIT: I do see the output message in the Debug Output windows of Visual Studio, just not in the file.

erotavlas
  • 4,274
  • 4
  • 45
  • 104
  • Are you using log4net or some other library? Please add the appropriate tags and also include the log4net configuration for your appender if that is what you are using. – Scott Chamberlain Jun 11 '14 at 22:13
  • @ScottChamberlain no just basic .net Trace and TraceSource. But I think I found the reason was the buffer needs to fill up to a certain amount before it can write to file. When i used a bigger message the file updated. – erotavlas Jun 11 '14 at 22:16

1 Answers1

0

I think I found an explanation here Trace file isn't being created even though TraceEvent is called?

"Writers flush to disk when their internal buffers fill, if memory serves me the default buffer size is 8KB. This is not a facet of trace listeners, but the underlying file stream it writes to."

Community
  • 1
  • 1
erotavlas
  • 4,274
  • 4
  • 45
  • 104