The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


AlwaysUp Feature Spotlight: Capture Console Output

AlwaysUp Feature Spotlight: Capture Console Output

What is the “capture console output” feature? Why would I use it?

When you run your application as a Windows Service with AlwaysUp, your app doesn’t come up on your desktop. Instead, your program runs invisibly in the background — on the isolated Session 0 desktop.

And even though running out of sight is fine for many situations, what if you need to see your application to make sure it’s working properly? That can be tricky — especially for Windows GUI programs.

However, there’s an easy workaround if you’re running a console application.

Simply instruct AlwaysUp to capture all the text that your application prints to the console and save that text to a file. Afterwards, you can read the file to see what your program printed.

For example, here’s the text that AlwaysUp saved when running Rclone as a service:

Rclone Output File

And capturing text helps our customers running Logstash in the background as well:

Logstash Output File

When to save console output to a text file

You should consider capturing your application’s console output whenever:

  • You’re running a text-based application, like a batch file — not a GUI program;

  • You must preserve all the messages your application reports;

  • Your application is failing and you’d like to know if it’s printing an error message;

  • You’re want to keep a close eye on your application, for example when troubleshooting a problem.


How do I capture console output in AlwaysUp?

The “capture output” feature is available on the Extras tab when configuring your application in AlwaysUp.

Simply enable the Capture output to this log file option and enter the full path to the file to record the text:

Capture console output from the Extras tab

Furthermore, if your application produces lots of text, you can check the Automatically box and determine what to do when the file gets large.


What are your best tips for capturing text?

Tip #1: Set a maximum size for the text file

The output file may be difficult to work with if it gets huge. To avoid that, you should specify a reasonable limit for the text file.

We recommend capping the file at 20 MB or less. That’s room for a lot of text!

Tip #2: Decide what to do if the file grows too large

If the file reaches its maximum size, AlwaysUp can either:

  • Trim the file, discarding the oldest 25% of the contents; or

  • Rollover the file, renaming it to include the current date and starting fresh with an empty file.

Be sure to choose the option that’s most appropriate for your situation. For example, you shouldn’t trim the file if you need to preserve all the entries written to the console.

Tip #3: Avoid locking the file while your application is running

An application that locks the output file will prevent AlwaysUp from adding new text to the file. If that happens, you may miss some of the data that your application has written to the console.


Posted in AlwaysUp | Tagged , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *