将 TraceSource 拆分为多个级别的 TraceListener
我尝试使用两种不同的日志级别设置 MySource 跟踪源。文件日志应跟踪所有内容(详细),系统事件日志应仅跟踪错误。
以下设置似乎已终止对 FileLog 的记录。我做错了什么?
<sources>
<source name="MySource" switchName="MySource.Switch">
<listeners>
<add name="FileLog"/>
</listeners>
</source>
<source name="MySource" switchName="MySource.SystemSwitch">
<listeners>
<add name="EventLog"/>
</listeners>
</source>
</sources>
<switches>
<add name="MySource.Switch" value="Verbose"/>
<add name="MySource.SystemSwitch" value=Error"/>
</switches>
I trying to setup MySource trace source using two different log levels. FileLog should trace everything (verbose) and system event log should trace only Errors.
The following setup appears to have killed logging to FileLog. What am I doing wrong?
<sources>
<source name="MySource" switchName="MySource.Switch">
<listeners>
<add name="FileLog"/>
</listeners>
</source>
<source name="MySource" switchName="MySource.SystemSwitch">
<listeners>
<add name="EventLog"/>
</listeners>
</source>
</sources>
<switches>
<add name="MySource.Switch" value="Verbose"/>
<add name="MySource.SystemSwitch" value=Error"/>
</switches>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
每个源仅包含一个
,具有多个监听器,然后在监听器上添加过滤器,如下所示:You include
<source>
only one per source, with multiple listeners, then add filters on listeners, like so: