.net 我在哪里可以得到 System.Diagnostics.Trace.WriteLine 的结果
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5931702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where can I get the result of System.Diagnostics.Trace.WriteLine
提问by Carlos Liu
In my code I have write some trace message by using System.Diagnostics.Trace.WriteLine, but where could I get the message? I have looked at event viewer but did not find.
在我的代码中,我使用 System.Diagnostics.Trace.WriteLine 编写了一些跟踪消息,但是我从哪里可以得到消息?我看过事件查看器,但没有找到。
采纳答案by ariel
回答by Nico
Virtually, the key feature of Trace is that the trace messages are independentfrom the IDE basically. Because trace messages are also available in the release build, you can also get them, when the software was already shipped and/or you have no IDE in avail. You guessed right, there is a tool, which makes you see those messages apart from VS. If you are not debugging (i.e. no debug-console allocated in VS), you can see the trace messages with the tool Debugviewrunning in parallel instead of Windows' EventViewer. It is also possible to write trace messages to a file by editing/creating a *.config file accompanying the assembly in question, which also records the history of messages.
实际上,Trace 的关键特性是跟踪消息基本上独立于 IDE。因为在发布版本中也提供了跟踪消息,所以当软件已经发布和/或您没有可用的 IDE 时,您也可以获得它们。你猜对了,有一个工具可以让你在 VS 之外看到那些消息。如果您不进行调试(即在 VS 中没有分配调试控制台),您可以使用并行运行的工具Debugview而不是 Windows 的 EventViewer来查看跟踪消息。还可以通过编辑/创建伴随相关程序集的 *.config 文件将跟踪消息写入文件,该文件还记录了消息的历史记录。

