python-tail
python-tail copied to clipboard
Rotating files will break the follow method
Just so you're aware, due to the way Python's file handler works, an open file which is rotated will break your follow loop. I had this problem in an application I wrote recently. As far as I know, there's no simple fix for it. In fact I had to do some nasty hacking which involved triggering a SIGHUP and catching it in the application then handling the reloading of the file. If you're curious check out logmon: https://github.com/maxcountryman/logmon (see the bottom of the README).
I need rotating files support too.
@brunoqc you can easily build it in. See my instructions in the logmon README.
IMHO, the best way to avoid locking is to just write a wrapper of unixutils tail
on windows and tail
on posix platforms.
I've been using unixutils tail for about 10 years and its never failed me.
FYI - Found bugs with unixutils
tail and found a way to extract the binaries from cygwin for standalone use (no install required). I also wrote a wrapper for this so one can process in python: