Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: CGI::Carp fatalsToFile

by afoken (Chancellor)
on Oct 05, 2021 at 22:01 UTC ( [id://11137248]=note: print w/replies, xml ) Need Help??


in reply to Re^2: CGI::Carp fatalsToFile
in thread CGI::Carp fatalsToFile

Just omitting CGI::Carp and just using plain old Carp should do the trick. Carp behaves nicely and writes all errors to STDERR, where they belong. The web server collects STDERR output and writes that to its error log. Problem solved, even when multiple CGIs are running concurrently (which might create nasty races when trying to write to a common log file at the CGI level). That also works when your CGI has a really bad day and just crashes before Carp or CGI::Carp can do their work.

The only remaining problem might be the hoster: Some really cheap hosters prevent you from reading your server's error log. That really sucks, and cannot be solved completely at the application (CGI) layer. If that is the case, consider changing the hoster or upgrading to a contract with access to the error log.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^4: CGI::Carp fatalsToFile
by Bod (Parson) on Oct 05, 2021 at 23:17 UTC
    Just omitting CGI::Carp and just using plain old Carp should do the trick

    It's late here so a quick test before I head to bed...
    I've changed from CGI::Carp to Carp in the script that gives the 500 error as suggested. Of course it makes no difference to the way the script behaves. But also, it doesn't write anything to the cPanel error log.

    The only remaining problem might be the hoster: Some really cheap hosters prevent you from reading your server's error log

    I've never been entirely sure what the cPanel error log actually is so I have dived into the documentation to find out. Its says "The interface includes entries in the /usr/local/apache/logs/suexec_log file and the /usr/local/apache/logs/error_log file"

    Not knowing a great deal about the inner workings of Apache and cPanel, it looks to me like the latter will be the right error log file where these sorts of errors should be written. Certainly lots of "File does not exist" errors get written there along with a few Perl warnings and the odd MariaDB error.

    The script I am calling gets listed in the suEXEC log but the one that it calls (the one with the error) does not.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-03-29 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found