Posted By

micmath on 07/27/07


Tagged

perl


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

mabridge


Redirect everything to log file.


 / Published in: Perl
 

  1. $logfile = "/tmp/mylog.txt";
  2. open STDOUT, ">>", $logfile or die "cannot append to '$logfile': $!\n";
  3. open STDERR, ">&STDOUT" or die "cannot dup STDERR to STDOUT: $!\n";
  4. select STDERR; $| = 1;
  5. open LOG, ">&STDOUT" or die "cannot dup LOG to STDOUT: $!\n";
  6. select LOG; $| = 1;
  7. select STDOUT; $| = 1;

Report this snippet  

You need to login to post a comment.