python-tail icon indicating copy to clipboard operation
python-tail copied to clipboard

Rotating files will break the follow method

Open maxcountryman opened this issue 13 years ago • 4 comments

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).

maxcountryman avatar Dec 30 '11 21:12 maxcountryman

I need rotating files support too.

bbigras avatar Feb 01 '12 17:02 bbigras

@brunoqc you can easily build it in. See my instructions in the logmon README.

maxcountryman avatar Feb 02 '12 01:02 maxcountryman

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.

JavaScriptDude avatar Apr 14 '22 23:04 JavaScriptDude

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:

JavaScriptDude avatar Apr 28 '22 15:04 JavaScriptDude