in reply to logging and cron jobs

One way to handle this is to create a seperate log file for every run of the program, using the time and PID to create a filename. To look through some or all of the logfiles, you can then use the shell's wildcards.

For example, if you created logfiles named yourapp.yyyy-mm-dd-hh-mm-ss.pid, you could look at all the logs from 2005 with something like cat yourapp.2005-*.

You could do this with a small wrapper program to manage the logfiles and run your program with STDERR connected to a pipe the wrapper program reads; that would require no changes to your current code.