in reply to redirect STDERR to my log file, also funny *FOO notation.

This is what I use:
# Get filename components ($filename, $filedir, $filext) = fileparse($0, '\..*'); # Create filename; note the ./log sub-dir $logfile = "${filedir}log/$filename.log"; # Redirect STDOUT & STDERR to named logfile open( STDOUT, ">>$logfile") or die "\nUnable to open STDOUT -> $logfile: $!\n +"; open( STDERR, ">>&STDOUT"); # Set autoflush on select (STDERR); $| = 1; select (STDOUT); $| = 1;
Works fine for me.
The reason I unbuffer the log file is that if the prog exits unexpectedly, you may not get the last msg or 2, which are usually the ones that tell you why/where it failed(!)
Cheers
Chris

Replies are listed 'Best First'.
Re^2: redirect STDERR to my log file, also funny *FOO notation.
by JohnMG (Beadle) on Nov 15, 2005 at 15:48 UTC

    > select (STDERR); $| = 1;

    Isn't STDERR already unbuffered by default?

      Yes, but it doesn't hurt to make sure! _________________________________________________________________________________
      Without me, it's just aweso