【发布时间】:2013-10-04 00:48:07
【问题描述】:
我遇到了这个:Winforms logging framework
但是,我无法让它工作。
在 app.config 中,我有以下内容:
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="yourName" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\mylogfile.txt" />
</listeners>
</trace>
</system.diagnostics
在我的代码中,我将以下内容写入日志文件:
Trace.Write("test");
Trace.TraceError("There's been an error captain: {0}", e);
Trace.TraceWarning("The system broke but don't worry.");
Trace.TraceInformation("Starting up the engines.");
文件已创建。但是没有任何东西被写入。跟踪已在 Visual Studio 中打开。
不确定这里缺少什么。
【问题讨论】:
标签: c# .net winforms logging trace