in reply to Capturing Error message in a log file.

I haven't been successful so far.

If the $debug_output file is not getting written to, take a look at the error message if/when the open fails:
open(OUT, ">>$debug_output") || warn "Could not append to $debug_outpu +t - $!\n";
Check the value of $debug_output to make sure it contains a valid filename/path. Check permissions of the file etc...

-- vek --