in reply to Copy STDOUT and STDERR to logfile and also display to screen

on Unix, pipeing the output to a new forked process is the only way that would work in any case:
select STDERR; $|=1 unless (open STDERR, '|-') { eval { open ERRLOG, ">/tmp/errlog" or die; while(<>) { print ERRLOG $_; print STDERR $_; } }; exit(0); } # repeat for STDOUT

Replies are listed 'Best First'.
Re^2: Copy STDOUT and STDERR to logfile and also display to screen
by boat73 (Scribe) on Aug 11, 2005 at 11:51 UTC
    Sorry guys, I should have mentioned I am doing this on a Win32 system at the moment. The Unix stuff will come in handy though.