Wening Andreas wrote:

> Hi all,
> 
> I posted a similar question a while ago but the answers didn't really
> resolve my problem.
> 
> I want to redirect all output in a file. Therefore I start my script like:
> myscript.pl >>logfile.txt
> 
> That works fine for STDOUT but all error messages don't get into that file,
> no I got the suggestion to do:
> myscript.pl >>logfile.txt 2>&1
> 
> That adds the STDERR output to my file but not at the right time. So my log
> file contains all the STDOUT output and then all the STDERR output. I want
> to have the errormessages exactly then written to the logfile when they
> happen and I'm wondering if I can redirect the stream to STDOUT like:
> open STDERR, ">> STDOUT"
> 
> But this didn't work. I also tried to write to the same file like:
> open STDERR, ">> logfile.txt";
> but this didn't work too (I guess I can assign a file only to one output
> stream).
> 
> Can anybody help?


Try in your script:

$| = 1;         # unbuffer STDOUT (since STDERR is unbuffered)

open STDERR, ">&STDOUT";



-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to