Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How do I...Redirect error.log data to a file of my chosing

by Beatnik (Parson)
on Jun 01, 2002 at 07:31 UTC ( [id://170891]=note: print w/replies, xml ) Need Help??


in reply to How do I...Redirect error.log data to a file of my chosing

Try CGI::Carp?
BEGIN { use CGI::Carp qw(carpout); open(LOG, ">>/usr/local/cgi-logs/mycgi-log") or die("Unable to open mycgi-log: $!\n"); carpout(LOG); #Correct way, according to tchrist, is carpo +ut(\*LOG); }
Or you can just use fatalsToBrowser :)

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

Replies are listed 'Best First'.
Re: Re: How do I...Redirect error.log data to a file of my chosing
by crazyinsomniac (Prior) on Jun 01, 2002 at 10:16 UTC
      Your choice ofcourse :) the CGI::Carp POD mentioned the above example :)

      Greetz
      Beatnik
      ... Quidquid perl dictum sit, altum viditur.

      This works great...

      I'm finding that having to run my script, having it fail, going to the log file, openning it, scrolling to the bottom is just too time consuming. How can I carpout to the browser for faster debugging?

      ======================
      Sean Shrum
      http://www.shrum.net

Re: Re: How do I...Redirect error.log data to a file of my chosing
by Kanji (Parson) on Jun 01, 2002 at 13:13 UTC

    If that open failed, how would S_Shrum be any more enlightened? :)

    Perhaps something more along the lines of...

    open(LOG, ">>/usr/local/cgi-logs/mycgi-log") or do { my $error = "Unable to open mycgi-log: $!\n"; print "Content-Type: text/plain\n\n", $error; # to the screen die $error; # & the logs };

    ...until you're sure that isn't going to kill the script, too (keeping in mind that you may reveal your log path to any visitors).

        --k.


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://170891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-28 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found