4

I have a live e-commerce site which is seemingly random (in that all the reports appear to be different) error where, at some point, during the checkout process, the entire thing gives up and I get a white screen of death.

I can't enable debugging (at least verbosely) on this site, but I'd like to be able to capture all of the EE and Session Data (either in a text file, third party service or simply email dump it all to me) and then instead of the white screen, I'd like to present the user with a 'Sorry somethings broken, but we've been notified and we'll look into it!' kind of message.

What are my options here? Whats the best way to get this kind of information out of EE? It's an older version of EE (v 2.5.3), with add-ons which have had custom hacks on them so none of it can be upgraded (the site is in fact being rebuilt, but is 2-3 months off completion).

The client naturally doesn't want to spend a huge amount of time debugging a somewhat impossible bug, but in the same respect we have no idea how many orders are being lost to this random issue.

Thanks!

2
  • 2
    Maybe with New Relic? You can configure it to keep track of errors and send alert. – pvledoux Oct 21 '13 at 21:16
  • 2
    What kind of server access do you have? Can you check server logs to check for errors? (often found in /var/log/httpd or similar locations). That won't give session data, but you may get an error message to work with. – fideloper Oct 21 '13 at 21:19
4

You can log errors to a file using php_value error_log in your .htaccess file:

https://stackoverflow.com/questions/11330041/specify-a-relative-path-to-php-value-error-log

Here's a recommended .htaccess setup:

php_flag display_errors 1
php_flag display_startup_errors 1
php_value error_reporting 30719
php_value error_log /home/USER/log/PROJECT.log
php_flag log_errors 1

You could also add something like this at the top of index.php to help provide context:

error_log($_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['PHP_SELF'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''));

As for handling the white screen itself - try wrapping a try/catch around the require_once at the bottom of index.php. The catch block could then be used to display a more friendly message.

1

I'd suggest turning on CodeIgniter logging. In your config.php file set the value for $config['log_threshold'].

0 = Disables logging, Error logging TURNED OFF
1 = Error Messages (including PHP errors)
2 = Debug Messages
3 = Informational Messages
4 = All Messages

You'll need to also create the /system/logs/ folder and set it to be writable. You can overwrite the location by setting the $config['log_path'] in your config file.

Don't forget to turn logging off when you're done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.