in reply to Proc::Daemon logging issue - log only populates on daemon exit

I guess killing the program closes the file-handle and flushes the buffer.

Yes, but you can flush without closing the file or terminating the program:

use IO::Handle; ... open LOG ... LOG->autoflush(); # or flush manually as needed: ... LOG->flush();

(Note that $| = 1 applies to the currently selected handle, which is not LOG, unless you explicitly select it (by default it's STDOUT).)

Replies are listed 'Best First'.
Re^2: Proc::Daemon logging issue - log only populates on daemon exit
by tizatron (Novice) on Dec 14, 2010 at 21:48 UTC
    Many thanks - this is what I needed. I also appreciate you explaining the $| = 1. As you suspected - I was hoping this flushed the LOG - which was not only incorrect but explains why this worked when I had the program outputting to STDOUT.

    Adding the autoflush is working as expected.