【发布时间】:2013-06-07 08:36:11
【问题描述】:
为了禁用 FirebirdSQL 日志记录,我需要在 app.config 中添加以下代码 (See here):
<system.diagnostics>
<sources>
<source name="FirebirdSql.Data.FirebirdClient" switchValue="Off">
<listeners>
<clear />
</listeners>
</source>
</sources>
</system.diagnostics>
这成功了,即没有记录任何内容。 现在我已经在 C# 代码中这样做了,但是尽管我的代码记录了所有内容:
TraceSource ts = new TraceSource("FirebirdSql.Data.FirebirdClient");
ts.Switch = new SourceSwitch("sourceSwitch", "Off");
var listeners = ts.Listeners;
listeners.Clear();
ts.Switch.Level = SourceLevels.Off;
我添加到执行 SQL 语句的程序集中。
我错过了什么?
【问题讨论】:
标签: c# logging tracelistener