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
とにかく毎回Flush()を呼び出すのではなく、即座にトレースメッセージを書くことがありますか? – imak
@imak:あなたは ''と思っていますが、正直言って私は自分でトレースリスナーを使っていません。 –