Redirecting STDERR to STDOUT? 
Author Message
 Redirecting STDERR to STDOUT?

This is somewhat of a CGI problem also, but I am working in Perl, so
perl specific info would be helpful.

Basically, I do not have access to the error logs, or at least i cannot
get tech support at my web host to respond with their *location.*

Is there a way to redirect the error messages generated by die and such
to STDOUT? I thought I came across this once, but I can't remember
where!

If this has been discussed before, or there is a pertinent FAQ that I
have missed, would someone be kind enough to direct me a bit more
specifically?

Thanks,

Dejah
--
i trust i make myself obscure, i have need of obscurity now- robert bolt

a heated exchange of unread mail would be welcomed by all- christensen

Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
http://www.*-*-*.com/



Thu, 17 May 2001 03:00:00 GMT  
 Redirecting STDERR to STDOUT?

Quote:
> Basically, I do not have access to the error logs, or at least i cannot
> get tech support at my web host to respond with their *location.*

find the server configuration file, or use Find::File.  my guess is they
don't know where they are either.  at least that's been my experience
with those sorts :)

Quote:
> Is there a way to redirect the error messages generated by die and such
> to STDOUT? I thought I came across this once, but I can't remember
> where!

find the magic line in the script below.  it's also in the FAQ
somewhere.  of course, if you test with CGI.pm and you are hooked
up to a tty, you'll get the STDERR on your screen.

Quote:
> If this has been discussed before, or there is a pertinent FAQ that I
> have missed, would someone be kind enough to direct me a bit more
> specifically?

you probably want to see the several ways that i presented in
The Perl Journal #9.  in synopsis, see CGI::Carp for ready to
use functions.

here's what i've been doing in development scripts lately (with
a few bits snipped):

BEGIN
   {
   my $old_W = $^W;

   $VERSION = '19981125.001';

   $^W = 0;

   $ENV{'PATH'} = '';

   $debug = 0;

   sub debug
      {
      $debug = 1;

      $| = 1;

      print "Content-type: text/plain\n\n";
      print "YOU ARE IN DEBUGGING MODE - thanks, the management\n";
      print "This is process $$\nReal user is $<\nEffective user is $>\n";
      print "This is VERSION $VERSION\n\n";

      open STDERR, ">&STDOUT";

      $^W = 1;
      }  

   debug if $debug or $ENV{'CGI_DEBUG'} eq '1';

   my $who = 'name_of_script';

   $^W = $old_W unless $debug > 0;
   }

--

CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>



Thu, 17 May 2001 03:00:00 GMT  
 Redirecting STDERR to STDOUT?
Hi Mary,

An easier solution might be to create your own error_log.  You can make a
new file wherever you want, and redirect all the STDERR to that file.
I've had to do this before because of exactly your situation.

This code should do it:

open (STDERR, ">>/some/dir/error_log") or die $!;

I think some servers make you be more careful about how you open or close
STDERR, but my experience is with Apache, and the above should work fine
with it.

Quote:

>This is somewhat of a CGI problem also, but I am working in Perl, so
>perl specific info would be helpful.

>Basically, I do not have access to the error logs, or at least i cannot
>get tech support at my web host to respond with their *location.*

>Is there a way to redirect the error messages generated by die and such
>to STDOUT? I thought I came across this once, but I can't remember
>where!

>If this has been discussed before, or there is a pertinent FAQ that I
>have missed, would someone be kind enough to direct me a bit more
>specifically?

>Thanks,

>Dejah
>--
>i trust i make myself obscure, i have need of obscurity now- robert bolt

>a heated exchange of unread mail would be welcomed by all- christensen

>Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
>http://www.DejahsPrivateIce.com



Thu, 17 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. redirect STDERR to STDOUT ?????

2. redirecting stderr and stdout

3. Redirect stderr to stdout w/ Perl under Unix?

4. Redirecting STDERR to STDOUT (on NT)

5. redirecting stderr to stdout

6. redirect stderr and stdout to same file

7. redirect stderr and stdout to the same file

8. Redirect stderr to stdout inside perl script

9. Redirecting stderr to stdout

10. how to redirect stderr and stdout to same file

11. How do I redirect STDERR and STDOUT?

12. Redirecting STDERR to STDOUT

 

 
Powered by phpBB® Forum Software