<font face="courier new,monospace"><br>Since the list has been quiet lately, I thought I'd ask the<br>brilliant minds for a suggestion.<br><br><br>...logging...<br><br>[ and yes I know about all the mega-logging frameworks, but ...]<br>
<br>To add simple logging simply, to my app, I decided to close and<br>reopen STDOUT and STDERR pointing at a log file at the start of my app.<br>This enables me to simply print and have stuff captured without<br>having the overhead of a framework.<br>
</font><br><font face="courier new,monospace"> close STDOUT; open STDOUT, ">>", "$filename"; STDOUT->autoflush(1);<br> ...<br> print "log this\n";<br><br>This technique works great until someone/something comes along<br>
and (re)moves the log file out from under me (like logrotate).<br>My logging is still happening, but to the original file, and not<br>the 'new' (empty) file. Since I never re-open the file,<br>my information isn't going where I expect it to.<br>
<br>If I open/write/close on every message it would work right,<br>but then my simple approach of catching prints doesn't.<br><br>Is there some magic way to detect this occurrence and auto-reopen<br>the 'new' file?<br>
<br>[Something like tie'ing to a handle's output functionality and<br>so it could open/print/close everytime instead.]<br><br>TIA<br>Fulko<br><br></font>