我有自定义跟踪侦听器,它记录到我试图在 ViewModelLocator 中找到的字符串(我将绑定到 wpf 文本框),它(或我定义的所有其他侦听器)似乎不是在 System.Diagnostics.Trace.Listeners 中)
App.config 片段
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="RomanExampleWPFAppSwitch" value="Verbose" />
</switches>
<sources>
<source name="RomanExampleWPFApp" switchName="RomanExampleWPFAppSwitch">
<listeners>
<remove name="Default" />
<add name="RollingLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" initializeData="RollingLogWriter" append="true" autoFlush="true" baseFileName="RomanExampleWPFAppLog" location="LocalUserApplicationDirectory" logFileCreationSchedule="Daily" reserveDiskSpace="1073741824" traceOutputOptions="DateTime,LogicalOperationStack" />
<add name="StringLog" type="RomanExampleWPFApp.Other.StringLogTraceListener, RomanExampleWPFApp" />
<add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>