Log Follow v1.5.5

Introduction:

log_follow lets you see the content of text files in soft real-time.  It is a gui that gives the functionality of tail -f while adding some extra features.  If you have never used tail -f, the way log_follow works is by telling it which text file you want to follow.  As another program makes changes to the log file, log_follow's main window will be updated to stay in sync.

log_follow has some extra features that are difficult to script using tail -f.  If you look at the screen capture above, you will see three checkboxes.  The first checkbox is labeled "Scroll."  If enabled, log_follow will automatically scroll when new text is added; if disabled, log_follow will not scroll.  By disabling scroll, it will be much easier to keep your place while reading.  As a convenience, any time you click in the window, e.g., to copy text, scroll will be disabled.  You can automatically start log_follow in scroll mode by adding the -s command-line flag.

The second checkbox is labeled "Warp."  When warp is enabled, log_follow will automatically switch to view any new log file that is detected.  log_follow considers a new log file to be any file with the same basename as the file you are currently following.  For example, if you are viewing the file log.001 and log.002 is created in the same directory, log_follow will stop viewing log.001 and start viewing log.002.  You can automatically start log_follow in warp mode by adding the -w command-line flag.

The third checkbox is labeled "Incoming."  This checkbox is used to alert you when something new has been logged.  If you specify the "--odelay <secs>" option, the checkbox will automatically uncheck itself after <sec> seconds delay.  With or without the --odelay flag, log_follow will respect your manual control of the checkbox which allows you to manually mark all text as old at any time.

log_follow knows how to color code text to make it easy to distinguish new text from old text.  Just add the "--nfg <color>" and the "--ofg <color>" command-line flags to set the new and old foreground colors respectively.  You can also add the "--blink" command-line flag to force log_follow to flash a visible bell when something new is logged.  Lastly, you can use the "--cr" flag to instruct log_follow to allow you to use <enter> to input carriage returns at the cursor or <ctrl><enter> to insert a carriage returns at the end of file.  The extra spacing can be used to help you visually separate parts of the log file.  (The carriage returns are not written to disk.)

For this release, log_follow detects changes by polling. The default is to check about every half second. If you want more responsiveness or less cpu consumption, you can alter the polling periods.  Use the "--pc <freq>" command-line flag to alter how frequently you check for new content.  Use the "--pf <freq>" command-line flag to alter how frequently you check for new log files.

You can jump to the bottom of the file using <ctrl><arrow_down> and return using <ctrl><arrow_up>.  This allows you to bookmark what you are currently reading so you can see new log messages without losing your place.

The log file you want to follow does not have to be in existence when you start log_follow.  For example, if you start log_follow with "log_follow -s -w log" when no "log.*" files are present, log_follow will detect when they are created and load them then.

You can see all the command-line flags by starting log_follow with the -h flag.

Practical Applications:

The syslog program creates log files that are periodically truncated when the log files are rotated by cron.  You can follow this type of log file by starting log_follow as follows:

log_follow -s <file>

Some operating systems make it hard to write to stdout or stderr.  On these systems, you can create your own log file and use log_follow to view its contents as follows:

log_follow -s <file>

The crafty chess program creates a new log file for each game played.  crafty's log files are named log.001, log.002, etc.  You can follow crafty's log files by starting log_follow as follows:

log_follow -s -w log

The command I use for starting crafty is as follows:

log_follow --blink --cr -s -w -nfg blue -odelay 10.0 log

log_follow can color code its output so you can easily distinguish between new and old text. (Not all color combinations are possible. So, don't waste too much time if your command-line options are overridden with black or white.) The command used for starting the instance of log_follow in the screen capture above is as follows:

log_follow -s --cr --bg black -nfg yellow -ofg cyan

Installation:

I provide pre-built executables. To run, just download the correct executable below for your system.  Place it in any directory and make sure the file permissions on your copy allow execution.

Distribution:

The source is not currently downloadable because log_follow uses some unrelated personal libraries that are not part of the source tree proper.  If anyone is interested in the source, I might make the time to merge these libraries with the log_follow code to make one coherent source tree.  If you want to build a program from source to follow crafty's log files, try craftywatcher.

License:

Log Follow is released under a BSD-style License.

ChangeLog:

ChangeLog