views:

172

answers:

2

In Winform Apps Console.WriteLine() writes to the IDE output tab. In a console app it writes to the console and not to the IDE output tab. For debugging reasons i find it easier if i can have i have a copy of the Console output (ATM i only use stdout) in my IDE. Is there an option to have Console.WriteLine() appear in both?

I use visual studios 2008 & 2010

+1  A: 

Possibly the same question as this.

As far as I know you cannot intercept StdIn, StdOut, and StdErr for console windows. You could use one of the options in the above link though (trace debugger, capture output, etc).

Another option might be to use something like log4net to stream to a more convient source only those messages you care about.

GrayWizardx
A: 

You can intercept all output to the stdout by calling Console.SetOut and passing in a TextWriter of yours. From there, the sky is the limit. Or something like that.

But if this kind of message writing starts to get serious I'd suggest using a real logging library like log4net or NLog.

Martinho Fernandes