Is it possible in C# to see the traces in a separate console. For example, I am having a window based application in which there are trace statements that will write the currently executed method name in to the console. When I run this application, it should automatically open a console and start the traces. Is this possible?
+3
A:
If you set the project type of your window application to Console, it will open a console window when you run it.
John
2008-11-04 06:19:59
But can this be configured in the run time. I mean is there any possibility for me to run the application with some debug switches (say Foo.exe -debug something like this) so that it will open a new terminal window that can trace log the messages ??
2008-11-04 07:33:07
+2
A:
I think you are looking for a TraceListener class. (another link)
In .NET you use a TraceListener to listen to your own trace message. And then you can print them out in a form with textbox or a console window.
Listeners can also be configured via app.config if my memory serves me right. That's so you could debug deployed applications.
chakrit
2008-11-04 07:03:46
+3
A:
You can create a console window by calling the Win32 AllocConsole API through P/Invoke.
James Curran
2008-11-04 07:51:53
A:
I'd recommend dbgview.exe from Sysinternals. It allows you to capture your trace output and save it to file (among other features).
You can get it from http://live.sysinternals.com
Philipp Schmid
2008-11-04 11:49:47