问题
In all my applications, I have always set
<trace autoflush="true" />
Is there any reason why someone would want not to do that?
I guess there is a performance impact, but how big is it?
回答1:
From the docs:
Trace.AutoFlush Property
Gets or sets whether Flush should be called on the Listeners after every write.
For performance reasons, you might prefer flushing less frequently (less IO). The downside of this is, lines that are not flushed will be lost in case of a crash.
Edit: The impact will be proportional to how frequent the trace is written to. If you aren't making a heavy use of it, the performance gain will possibly be ignorable. However, it is generally used in the whole codebase. Measuring is always better.
来源:https://stackoverflow.com/questions/17611189/why-would-i-turn-system-diagnostics-trace-autoflush-off