Every example of tracing in .NET people remove the “Default” listener:
<configuration>
<system.diagnostics>
<sources>
<source name="TraceSourceApp" switchName="SourceSwitch" switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="ConsoleListener"/>
<add name="ETWListener"/>
<remove name="Default"/>
</listeners>
What is the Default listener, and why is it there by default?
A Microsoft guy did benchmarks of the overhead with different listeners:
Default |===============================14,196 ms=====/ /================>
TextWriterTraceListener |=========211 ms======>
EventProviderTraceListener |=> 77ms
What is the Default trace listener, and why is it so slow? Is it OutputDebugString? Is OutputDebugString really two orders of magnitude slower than writing to a file?
Is there a .NET TraceListener that just uses OutputDebugString?
What is the default trace listener, why is it so slow, why is it customarily removed, and if it’s so bad why is it the default?
It’s not clear from that blog post how the code was run, but the
DefaultTraceListeneris documented like this:So if
Debugger.Logis actually printing to a UI window (and quite possibly scrolling it etc) I can see that causing a lot of the slowdown.