Tracing in .NET 中的“switch”和“filter”有什么区别?它们似乎以类似的方式工作。
<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>