Redirecting stderr--permanently

Redirecting stderr--permanently

Post by Nathan V. Patwardh » Sat, 11 Jan 1997 04:00:00



: Is there a way to arrange for stderr to be redirected to some file,
: without having to use the >& notation every time you start a program?  (I
: can't do that because my programs are CGI scripts that are launched by my
: web server; I need a way to debug these scripts, as regular stderr to the
: console is simply lost when one is in a web browser.)

From http://www.perl.com/perl/faq/perl-cgi-faq.html:

"In a CGI environment, STDERR points to the server error log file. You
can take this to your advantage by outputting debug messages, and then
checking the log file later on.

Both STDIN and STDOUT point to the browser. In actuality, STDIN actually
points to the server which interprets the client (or browser's) request
and information, and sends that to the script.

In order to catch errors, you can "dupe" STDERR to STDOUT early on in
your script (after outputting the valid HTTP headers): "

open (STDERR, ">&STDOUT");

--

"Nasal spray ... do you know where I can score some?"
                        - Charles Demar from _Better Off Dead_

 
 
 

Redirecting stderr--permanently

Post by Erik D. McWillia » Sat, 11 Jan 1997 04:00:00



>Is there a way to arrange for stderr to be redirected to some file,
>without having to use the >& notation every time you start a program?  (I
>can't do that because my programs are CGI scripts that are launched by my
>web server; I need a way to debug these scripts, as regular stderr to the
>console is simply lost when one is in a web browser.)
>Ted Sternberg
>San Jose, California USA

man dup
--
                              The CRT Corporation
                      Computer Based Research and Training


 
 
 

Redirecting stderr--permanently

Post by Theodore Sternber » Sat, 11 Jan 1997 04:00:00


Is there a way to arrange for stderr to be redirected to some file,
without having to use the >& notation every time you start a program?  (I
can't do that because my programs are CGI scripts that are launched by my
web server; I need a way to debug these scripts, as regular stderr to the
console is simply lost when one is in a web browser.)

Ted Sternberg
San Jose, California USA

 
 
 

1. Redirecting stdout and stderr, and stderr

        Can the following be done in bourne shell? (csh solutions are welcome
        as a second choice)

        STDERR and STDOUT are to be combined and redirected into one output
        file (so far, it's easy) while STDERR is to be redirected to a second
        output file.

        $ command > STDERR_AND_OUT  > STDERR

Thanks in Advance
Minoah Tam
--
Central Survey and Mapping Agency ("CSMA")

Voice: (306) 787-2823   Fax: (306) 787-4617

2. Which device is my SCSI cdrom?

3. ksh redirect stdout & stderr > file1, stderr > file2

4. CD-ROM Drive compatible with both Mac & Sun Sparc ELC ?

5. redirect stderr output

6. about the F compiler

7. Redirect stdout and stderr in ksh

8. BOURNE SHMOURNE...

9. redirect stderr to both screen and logfile at same time?

10. HELP: How to redirect stdout and stderr to a text file.

11. how to redirect stderr through pipe

12. bash : how to redirect both stdout and stderr to append a file

13. Redirect stderr and not stdout?