0
下面是代码消息没有写入文件,我做错了什么?
class Program
{
public static TraceSource TS = new TraceSource("myTraceSrc", SourceLevels.All);
static void Main(string[] args)
{
TS.TraceInformation("Hello Trace from Main");
}
}
这里是配置文件显示在控制台上
<system.diagnostics>
<sources>
<source name="myTraceSrc" switchName="switch1">
<listeners>
<add type="System.Diagnostics.TextWriterTraceListener" name="myLocalListener" initializeData="c:\Test.Log" />
<add name="consoleListener" />
</listeners>
</source>
</sources>
<sharedListeners>
<add type="System.Diagnostics.ConsoleTraceListener" name="consoleListener" traceOutputOptions="None" />
</sharedListeners>
<switches>
<add name="switch1" value="all" />
</switches>
</system.diagnostics>
消息,但一切正常文件。我究竟做错了什么?
@Jon:你这个人 – imak 2011-02-01 21:32:38