I have text file, like
log.txt which constantly updates.
I want some text editor which I can open on separate monitor to display this file.
I want this text editor to "reload" text file from disk periodically (every N seconds) and to scroll down.
What can you recommend?
If you prefer a GUI, you can use BareTail:
- free and paid versions available
- Like "tail -f" on Unix systems, but with many more features
- Tail multiple files
- Configurable highlighting
- Optimised real-time viewing engine
- View files of any size (> 2GB)
- Scroll to any point in the whole file instantly
- View files over a network
- Configurable line wrapping
- Configurable TAB expansion
- Configurable font, including spacing and offset to maximise use of screen space
If you just want to watch the log as it grows, look at the 'tail' utility in a command line window.
There's a port of some of the most common unix utilities to Windows at http://unxutils.sourceforge.net/ That package has the advantage that it requires nothing in the way of support - just drop the files somewhere in your path and they just work.
To use tail to watch a log file, open up a command line window (cmd.exe) and do:
tail -f <log.txt>
It'll just keep scrolling out the contents as the log file grows. Ctrl-C to stop.
If you have Git (or GitHub) installed, you can find the
tail utility available in Git Shell*. You can use it to follow any file:
tail -f logfile.log
Those experienced with Unix and Linux terminals will find this very familiar. Try
tail --help for more information.
* Usually this is a modified instance of Windows PowerShell.
You can also find the
less utility installed with Git. As per the help text:
F Forward forever; like "tail -f".
Note: I don't recommend installing Git just for this. But if you already have Git installed, there's no need to find third party
Log Expert is an open source alternative that is quite feature-rich. It has a so called tail mode to view the end of the file.
Some standard features:
- colorization of rows based on regex patterns
Some original features:
- columnizers - split a log row into fields and interpret fields as date, time, or various other data types (you can write your own custom columnizer).
- time sync - you can sync two files, and jumping to a certain time in one of them will sync the other to the same (or close) time
This Youtube video contains a screencast of the tool.
Or you can use
less, a free and open-source tool written and maintained by Mark Nudelman.
less +F log.txt
The advantage of
less is that you can toggle it between being a file viewer (this disables automatic scrolling, and lets you search and scroll manually) and a log follower. Ctrl+C takes you into "less" mode (file viewer mode). And Shift+F returns you to follow mode.
During development I use Emacs text editor to monitor logs.
emacs-w32 from Cygwin is easier way to get Emacs and necessary environment.
Tail update to certain kinds of files can be added via:
(defun my/auto-revert-tail-mode-hook ()
"Enable `auto-revert-tail-mode' for file in 'log' dir or ending on '.log'"
(when (string-match "/logs?/\\|\\.\\(?:log\\|out\\)\\'"
(add-hook 'find-file-hook 'my/auto-revert-tail-mode-hook)
With TRAMP and
ssh installed I can see updates in remote log files!