Reputation: 17539
I'm curious if anyone has figured out how to create their own Debug Output window in Visual Studio. For applications without a real console window (e.g. web apps), writing Debug or Trace messages end up in the Debug output window along with every other message (including overly verbose DLL loading messages).
It would be great if we could create a new named window which we could output to. Out of the box, there is "Debug", "Refactor" and "Build". A friend noted that TFS adds its own named window, so I'm hoping that there is some extensibility built in.
Any ideas? Thanks in advance.
Edit: I'm mostly curious if VS has any built in extensibility points for filtering. OR if there is a way to leverage the categories that Tracing allows you to append. It seems silly to me to add a label if it does nothing but append it to the front of the message in the same console.
Edit: I know about Trace
and TraceListener
. This question is about if there is any way to control/create a new Visual Studio's console debug window.
Upvotes: 1
Views: 1017
Reputation: 7407
I don't know if you'd consider this simple, but you can create your own TraceListener. With that you could route your debug messages anywhere you wanted.
Upvotes: 1
Reputation: 13488
Have you tried rerouting stdout to a stream of your choosing? Otherwise, I suggest a logging tool, of which there are many. Log4net comes to mind. In my applications I use a similar logging tool, such that
Log.Write("Some info goes here");
gets piped to a stream, and when printed, looks like
[2009 11 19 21:26:24] Some info goes here
The benefits of a logging tool is that you can select at runtime, where you want your logging text to end up. If you want to write to a file - great! If you want to transit via TCP/IP... you can do that too.
Upvotes: 2