On 8/29/06, Ken Foskey <[EMAIL PROTECTED]> wrote:

I can `open( STDERR, '>', 'error.log') ...` but is there a piece of
magic to duplicate that to STDOUT as well (ie same file output)

   open(STDERR, '>', 'error.log') or die "Can't redirect stderr: $!";
   open(STDOUT, ">&STDERR") or die "Can't redirect stdout: $!";

You should also be aware that STDOUT is normally buffered, while
STDERR is not; if you don't do anything about buffering, this may
result in an error message appearing unexpectedly early in the output.
That is, if your program dies partway through execution, the dying
words won't necessarily be the last thing in the file; part of a
buffer of ordinary output may follow.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to