Why would I turn System.Diagnostics trace autoflush off?

。_饼干妹妹 提交于 2019-12-23 19:31:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!