Reopening STDERR is right, but there is an other solution too, using $SIG{__DIE__} as follows (untested code):
BEGIN{ open LOGFILE, ">>", "/path/to/log" or die "cannot open logfile: $!"; $SIG{__DIE__}= sub { print LOGFILE $_[0]; } $SIG{__WARN__}= sub { print LOGFILE $_[0]; } }
In reply to Re: How do I output error messages to a file?
by ambrus
in thread How do I output error messages to a file?
by tphyahoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |