5 Ways To Monitor Log or Text File Changes in Real Time

Whether you are a general computer user, a professional or just a hobbyist, something that gets created a lot in Windows is log files or text files that report what a particular application or built in operation has been doing. A log file could be anything from a progress report by a small utility, to a connection activity log for your server to Windows Event log files or even Windows update logs.

Sometimes you might need to monitor a text or log file to see if it is creating any error reports or failure notices while the software is running. Loading the file into Windows Notepad will show you the content of the file but it will not refresh the contents in real time to show new entries while the file is open. With just using Notepad the file would constantly need manually closing and reopening.

A solution is to use another method that can automatically show the contents of a text or log file in real time, much like the Tail command included in Linux and Unix. There’s a few ways to accomplish this task in Windows, here we show you how.

Monitor Text Files In Real Time With A Third Party Utility

One obvious way to monitor log or text files is to use a separate tool to do it for you. There are several programs around with varying levels of sophistication and quite a few have the word “Tail” in their name to reflect the fact they are doing what the Unix Tail command does. We’ve chosen a couple of tools which are quite simple to use with enough options for the average user. mTail

mTail is free for personal use and you are encouraged to donate if you plan to use the program in a business environment. There are some quite useful features and a few advanced functions but for simple monitoring all you have to do is browse for or drop a text file onto the window and press Start.

mtail

In addition to a filter which will exclude lines that don’t include the keyword (that can be inverted), there’s also an alerter. The alerter pops up a separate window, plays a sound, sends an email or runs an external program when a keyword is found. The built in loaded text file manager allows you to set a number of individual parameters for each text or log file you want the program to monitor. mTail is also portable.

Download mTail


SnakeTail

SnakeTail is a small, open source and optionally portable program that can monitor standard text or log files and has the option to monitor the Event log files directly from the File menu. The program is tabbed so more than one file can be monitored at the same time. There is also the option to save a file monitoring session and return to it later on.

snaketail

The SnakeTail user interface is quite simple to use and you only have to drop a file onto the window to start monitoring. In the View Options you can create highlighted keywords with text coloring and the ability to launch an external program if the keyword is found. You can cycle through the highlights with Alt+Up/Down. There’s also a simple bookmarking system to remember specific lines.

Download SnakeTail

Monitor Text File Changes In real Time Using Notepad++

Notepad++ is great alternative to Notepad and one of the best free text editors around with a lot of powerful and very useful features. Although the program is not setup to monitor file changes in real time by default, with just a few setting changes it can be made to behave that way. When you normally open a file in Notepad++ and its content is changed by an external source, a window will popup with the prompt “This file has been modified by another program. Do you want to reload it?”.

notepad reload modified file

Every time the file is updated you will be shown the popup. If this prompt is turned off the file will automatically be reloaded silently every time it gets updated. In Notepad++ go to Settings > Preferences > MISC. and check the Update silently and Scroll to the last line after update boxes. The second box is optional and scrolls to the end of the file every time it’s updated and reloaded.

notepad enable silent updates

This method has a drawback because the file will only auto update if the Notepad++ window has focus, it won’t update if the program is in the background. When you bring the window back into focus the file will update itself.

Notepad++ Monitoring In The Background

If you want to have the text file update automatically while the Notepad++ window is not in focus, an alternative solution is the Document Monitor plugin. It’s a bit of a compromise because the update period is not real time but every 3 seconds. Go to Plugins > Plugin Manager > Show Plugin Manager, check Document Monitor in the list and click Install.

install document monitor plugin

Load the text file or select its opened tab and click Plugins > Document Monitor > Start monitoring. The plugin will scan the text or log file for changes every 3 seconds and automatically scroll to the end to show the updates, even while Notepad++ is not the active window.

Download Notepad++

Monitor A Text File From Windows PowerShell In Real Time

PowerShell has been integrated into Windows since Windows 7 although separate installer packages are available for XP and Vista. There are more advanced commands available in PowerShell as opposed to the Windows command line and one of those commands is a built in option for PowerShell to monitor a text file and show the changes. The command itself is quite simple and works on all versions of PowerShell:

Get-content pathtotextfile -Wait

The above has a problem though because it outputs the entire contents of the text file in the console before outputting any extra lines that are added. To get around this you can add a tail argument although you need to be running PowerShell 3 or above to use it. Windows 7 has version 2 by default so will need a newer PowerShell, Windows 8, 8.1 and 10 have PowerShell 3 or newer included, so will be OK.

Get-content pathtotextfile -Tail 0 -Wait

powershell get-content tail

With the inclusion of Tail the file will start being monitored from the end and not show the contents of the text file first. If you want to include xx number of lines at the end of the file then change 0 to the required number. It’s also possible to filter lines containing specific text.

Get-content pathtotextfile -Tail 0 -Wait | where { $_ -match "ERROR" }

With this command only lines containing ERROR in the text will be shown and in the above image only line three would be displayed. You can of course change the text in quotes to anything you want to help filter the lines you want to see.

Monitor A Text File From Command Prompt In Real Time

Although there are no built in command line tools that can monitor a text file for changes in real time, there are some around based on the Unix Tail command. Unxutils is a small suite of tools that have been ported from Unix to work in Windows. Download the UnxUpdates.zip, extract it and place Tail.exe and optionally Grep.exe in \Windows, \System32 or another folder found in the system PATH variables. The command is similar to the second option above:

Tail -n 0 -f pathtotextfile

command prompt tail

The -n argument is similar to the PowerShell -tail argument and simply starts reading from the end of the text file. To only include lines containing a specific keyword make use of the Grep command.

tail -n 0 -f pathtotextfile | Grep Error

One issue with nearly all available ported Unix Tail utilities is they are quite old, this one dates to 2003. It does though seem to work fine in Windows 7 and 10 under basic testing.

Leave a Reply

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

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please ask in our forum or contact us directly.