[英]How to configure Debug.WriteLine output file?
System.Diagnostics.Debug.WriteLine
用於跟蹤。
Funilly文件C:\\Users\\Public\\Documents\\UserNameFromProgramContext\\ProgramName.asserts
是在我的機器上創建的,但不是在另一個開發人員的文件上創建的。
我只想在VS的輸出窗口中輸出Debug.WriteLine
。
在哪里可以配置Debug.WriteLine
寫入的位置?
簡單:
Debug.Listeners.Add(new TextWriterTraceListener("c:\\temp\\test.txt"));
Debug.AutoFlush = true;
Debug.WriteLine("test");
所以只需使用Listeners集合來操作調試數據的寫入位置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.