I am trying to watch my log file with less --follow-name +F MyLogFile.log
.
From the man page:
If --follow-name is specified, during an F command less will periodically attempt to reopen the file by name.
F Scroll forward, and keep trying to read when the end of file is reached.
So if I understand correctly, less should keep trying to read MyLogFile.log. However, when my program restarts and rewrites MyLogFile.log, less does not see the new file until I restart less. But shouldn't less be "periodically attempting to reopen the file by name"? I must be missing something here. How can I use less as a log viewer when I'm constantly restarting my program?
For reference, here is the full explanation of --follow-name
, which seems to totally contradict what I am experiencing:
Normally, if the input file is renamed while an F command is executing, less will continue to display the contents of the original file despite its name change. If --follow-name is specified, during an F command less will periodically attempt to reopen the file by name. If the reopen succeeds and the file is a different file from the original (which means that a new file has been created with the same name as the origi- nal (now renamed) file), less will display the contents of that new file.
I am using less version 458 and OSX 10.12.4.