Spir Posted October 14, 2011 Share Posted October 14, 2011 Hello, on ne peut pas toujours tout prévoir, peut être qu'un bug subsiste lors de la mise en prod (module ou autre). Moi j'utilise une surcharge du "error_handler" Afin de logger les éventuels erreur. voici le code (dans le fichier override/classes/FrontController.php) : <?php class FrontController extends FrontControllerCore { public function __construct() { # define a custom error handler so we can log PHP errors set_error_handler('_exception_handler'); } } /** * This is the custom exception handler that is declaired at the top * of Prestashop. The main reason we use this is to permit * PHP errors to be logged in Prestashop Logger system since the user may * not have access to server logs. Since this function * effectively intercepts PHP errors, however, we also need * to display errors based on the current error_reporting level. * We do that with the use of a PHP error template. * * @access private * @return void * * @param $severity * @param $message * @param $filepath * @param $line */ function _exception_handler($severity, $message, $filepath, $line) { // We don't bother with "strict" notices since they tend to fill up // the log file with excess information that isn't normally very helpful. // For example, if you are running PHP 5 and you use version 4 style // class functions (without prefixes like "public", "private", etc.) // you'll get notices telling you that these have been deprecated. if ($severity == E_STRICT) { return; } $message = $message . ' - line ' . $line . ' in '.$filepath; Logger::addLog($message, $severity, NULL, NULL, NULL, TRUE); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now