Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Tail rotating logfiles with tie

by PotPieMan (Hermit)
on Sep 30, 2004 at 15:21 UTC ( [id://395375] : note . print w/replies, xml ) Need Help??


in reply to Tail rotating logfiles with tie

You might have found it in your research, but I've had luck with File::Tail. It lets you tie a filehandle to a rotating log file, automatically reopening the file if it detects that the file was truncated.

CPAN Testers says it fails on Windows, but you might be able to look at it for ideas or submit patches.

--Daniel

Replies are listed 'Best First'.
Re^2: Tail rotating logfiles with tie
by Brutha (Friar) on Oct 01, 2004 at 10:28 UTC
    Thank you for the hint, but I already looked at File::Tail. Tests fail under Windows, but to try minimum functinality this works.

    It also keeps the logfile open, which does not allow the logging program to rotate the file:

    Can't rename logfile to logfile.0: Permission denied

    And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
    (Terry Pratchett, Small Gods)