Wednesday, October 12, 2005

Problems with log files and daemontools

Daemontools is a software suite for Unix that makes it easy to run any program or script as a daemon.

I recently ran into an interesting problem with - none of the STDOUT output from my daemon was showing up in the log file.

It turns out that your daemon must use unbuffered STDOUT or it won't go into the log file. In my case the daemon is a Perl script so I added automatic flushing of output buffers to the script, and it works. That means I added this:

$| =1;

to the Perl script.

No comments: