c# - What does the autoflush attribute in trace element do -


i have following code in web.config file:

<system.diagnostics>     <trace autoflush="false" indentsize="4">       <listeners>         <add name="mylistener" type="system.diagnostics.textwritertracelistener" initializedata="textwriteroutput.log" />         <remove name="default" />       </listeners>     </trace>   </system.diagnostics> 

and somewhere in code behind:

system.diagnostics.trace.writeline("from trace"); 

after running application, textwriteroutput.log file created successfully, blank. however, after changing autoflush attribute true trace wrote textwriteroutput.log.

i noticed can make trace write textwriteoutput.log using

system.diagnostics.trace.flush();

instead of modifying autoflush attribute true.

i read in https://msdn.microsoft.com/en-us/library/system.diagnostics.trace.flush(v=vs.110).aspx didn't make sense me. why trace cannot write output file? can explain in simple words why?

the flush method forces output written file. setting autoflush attribute true causes trace written file, instead of being buffered.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -