|Think about Loose Coupling|
Tail'ing a log that frequently rolls overby frd1963 (Initiate)
|on Jan 08, 2009 at 22:48 UTC||Need Help??|
frd1963 has asked for the
wisdom of the Perl Monks concerning the following question:
I have written a script to look for a specific string occurring within a log on a windows system. The log fills up very quickly and therefore rolls over (rotates) often. For some reason though, while my script is running, the file will not roll-over, presumably because the rolling mechanism cannot get a suitable lock on the file. I have tried using File::Tail and POE::Wheel::FollowTail and both work fine except for not allowing the file to roll-over.
As an experiment, I have tried using SFU's "tail -f" and that doesn't keep the rollover from occurring, but of course also doesn't follow the new file when a roll-over does occur.
I can think of several ways to periodically release and re-open the file, but it is too easy to miss an occurrance of the issue that way.
I will paste the applicable code from both methods I have tried below.
Any enlightenment would be greatly appreciated,