On Feb 23, 2009, at 12:21 PM, Tim Wintle wrote:
On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote:
I've got a python script running as a daemon (using someone else's
daemon module). It runs fine for a while, but will occasionally balk
and die. Since its running in the background, I'm getting no error
from it.
What's the best way to capture the output into a file for later
review?
Point standard out to an open file handle?
And stderr.
I don't know how the OP's daemon is being launched, but the crontab
command below worked for me for redirecting errors to a log file
without the need to modify the script.
python /usr/local/foo/bar.py >> /var/log/foo/bar.txt 2>&1
HTH
Philip
--
http://mail.python.org/mailman/listinfo/python-list