简体   繁体   中英

How to configure Debug.WriteLine output file?

System.Diagnostics.Debug.WriteLine is used for tracing.

Funilly a file C:\\Users\\Public\\Documents\\UserNameFromProgramContext\\ProgramName.asserts is created on my machine, but not on that of another developer.

I only wanted Debug.WriteLine for output in the Output Window of VS.

Where is it possible to configure the place where Debug.WriteLine writes to?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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