简体   繁体   中英

DefaultTraceListener doesn't work

I'm trying to use the Debug and Trace classes with DefaultTraceListener. My messages appears normally in the Output window only when I start my application in Debug mode.

My question now, how can I get my messages in the output window when I run my application without debugging?

here is how I setup the Listener

DefaultTraceListener defaultListener = new DefaultTraceListener();
Debug.Listeners.Add(defaultListener); 

You won't see anything in the output window of visual studio unless you have the debugger attached. You could run debugview to view the output of Debug statements in your code. http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

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