0

I need to "Log" the Output of a Console application in real time without editing its code. That means I need an other program that reads the Console output and write it down. Can someone tell ma a good program that does this.

(The Application gives error outputs but then it closes himself after like 1 sek. so i need a way to get the last lines before it closes in a text file)

Filburt
  • 16,221
  • 12
  • 59
  • 107
Coffee
  • 19
  • 5

2 Answers2

3

First of all, try running CMD or PowerShell and calling your Console Application from there. The Console Application will terminate, but not CMD or PowerShell, allowing you to see the output.

Alternatively, you can create a script that redirects the output to a file:

ConsoleApplication.exe > file.txt

And save it as run.bat for example. The bat script when executed will create file.txt with whatever output the application had.

See also Redirect Windows cmd stdout and stderr to a single file.

Theraot
  • 18,248
  • 4
  • 45
  • 72
1

Well, Log4net would work for you if you could edit your existing application. it's simple and easy to use.

But since there can be no changes in existing application, try running the exe file from CMD. There are options to read the output through CMD.