What is the difference between "switch" and "filter" in Tracing in .NET? -


what difference between "switch" , "filter" in tracing in .net ? seem work in similar way.

<system.diagnostics>     <trace autoflush="true" indentsize="5">       <listeners>         <add name="demolistener" type="system.diagnostics.textwritertracelistener" initializedata="d:\output1.txt">         </add>         <remove name="default" />       </listeners>     </trace>         <sources>       <source name="demoapp" switchname="demoapp">         <listeners>           <add name="demolistener" type="system.diagnostics.textwritertracelistener" initializedata="d:\output2.txt">             <filter type="system.diagnostics.eventtypefilter" initializedata="error"/>           </add>           <remove name="default" />         </listeners>       </source>     </sources>     <switches>       <add name="demoapp" value="error"/>     </switches>   </system.diagnostics> 

there bit of overlap. <filter> names specific class write that's derived tracefilter. can use suppress trace output, possible. applies specific tracelistener.

the <switches> element useful configure tracing , set value of traceswitch object. test in code selectively bypass trace output. note how <switches> "global", doesn't apply specific listener. logical place test switch in tracesource. use switch configure tracing verbosity. "error" value indicate errors ever traced.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -