简体   繁体   English

如何配置Debug.WriteLine输出文件?

[英]How to configure Debug.WriteLine output file?

System.Diagnostics.Debug.WriteLine is used for tracing. System.Diagnostics.Debug.WriteLine用于跟踪。

Funilly a file C:\\Users\\Public\\Documents\\UserNameFromProgramContext\\ProgramName.asserts is created on my machine, but not on that of another developer. Funilly文件C:\\Users\\Public\\Documents\\UserNameFromProgramContext\\ProgramName.asserts是在我的机器上创建的,但不是在另一个开发人员的文件上创建的。

I only wanted Debug.WriteLine for output in the Output Window of VS. 我只想在VS的输出窗口中输出Debug.WriteLine

Where is it possible to configure the place where Debug.WriteLine writes to? 在哪里可以配置Debug.WriteLine写入的位置?

simple: 简单:

Debug.Listeners.Add(new TextWriterTraceListener("c:\\temp\\test.txt"));
Debug.AutoFlush = true;
Debug.WriteLine("test");

so just use the Listeners collection to manipulate where debug data is written to 所以只需使用Listeners集合来操作调试数据的写入位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM