views:

279

answers:

2

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.

+1  A: 

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.

Charlie Salts
Ideally I'd really just like to keep this simple just for development. I have the runtime verbose tracing coming through in the window but it is all junked up with other unrelated stuff. Log4Net would be overkill for the kind of things I'm trying to immediately solve. This isn't really for production logging just for dev tracing.
McKAMEY
A: 

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.

Jonathan Beerhalter
Agreed, and where I want it is in a new VS console window. That is really the heart of question.
McKAMEY