Redirect everything to log file.

/ Published in: Perl
Save to your folder(s)

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.