C#将调试输出写入.txt文件 [英] C# Writing debug output to .txt file
本文介绍了C#将调试输出写入.txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行代码,我希望我的调试输出写入文本文件。这是怎么回事?
我试着写:
I'm running code and I want my debug output to write to a text file. how does this work?
I tried to write :
TextWriterTraceListener[] listeners = new TextWriterTraceListener[] {
new TextWriterTraceListener("W:\\C.txt"),
new TextWriterTraceListener(Console.Out)
Debug.Listeners.AddRange(listeners);
Debug.WriteLine("Some Value", "Some Category");
但它仍然写到输出窗口...
我该怎么办?
谢谢。
but it still write to the output window...
What should I do?
thanks.
推荐答案
你可能会找到许多可用的日志记录类实现,只需 Google搜索 [< a href =https://www.google.co.uk/#q=C%23+logging+classtarget =_ blanktitle =New Window> ^ ]。
You might find many available implementation of a 'logging class', just Googling for [^].
这篇关于C#将调试输出写入.txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文