in reply to Errors uncaught by CGI::Carp
In an attempt to get to the bottom of this I have moved away from CGI::Carp qw(fatalsToBrowser) and instead I have tried using CGI::Carp qw(carpout) * by putting this in my BEGIN block.
BEGIN { use CGI::Carp qw(carpout); if ($RealBin =~ m!^(/home/xxx/yyy/(test|uk)/www)!) { $safepath = "$1/../lib"; } else { die "Illegal use of software - visit www.way-finder.uk to use +this site"; } open LOG, '>>', '/home/xxx/yyy/test_error_log.log' or die "Unable +to open error log"; carpout(\*LOG); }
I've tested it on our test site which doesn't give the 500 errors. The script returns the HTML as expected and writes a few lines about uninitialised stings to test_error_log.log. I've then added a die statement in the code and tested again - and again it writes that to the log file as expected.
This version of the script has been migrated to the production environment and, as expected, the same warnings get written to the log file. But, when the 500 error happens nothing gets written to the log file. So I've deleted the log file and refreshed the page and kept repeating until I get the error. The logfile is created but nothing is written to it.
What could cause the BEGIN block to execute but not the rest of the script without carpout writing anything at all to the log file???
* CGI::Carp qw(carpout) seems to be the fatalsToFile I was looking for in CGI::Carp fatalsToFile
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Errors uncaught by CGI::Carp
by pryrt (Abbot) on Oct 15, 2021 at 14:17 UTC | |
by Bod (Parson) on Oct 15, 2021 at 17:03 UTC | |
by Bod (Parson) on Oct 15, 2021 at 18:14 UTC | |
by pryrt (Abbot) on Oct 15, 2021 at 18:30 UTC | |
by Bod (Parson) on Oct 15, 2021 at 21:13 UTC |