php - Logging PDO exception to error_reporting and error_log -


currently script able display pdo exception on browser not logging error file. rather turn off browser error message using display_errors , log file using error_log instead. don't know if it's possible or if need write custom handler or it's being overridden framework. here log configuration in virtualhost. note it's logging other error messages including notices. not logging pdo exceptions. ideas?

i think can ignore value of display_errors of virtualhost configuration.

    php_admin_flag log_errors on     php_admin_flag display_errors on     php_admin_value error_reporting 30719     php_admin_value error_log "/....path/php.error.log" 

it turns out need override exception handler independent error handler. need forward exceptions error handler. theoretically, following should implemented.

<?php function exception_handler($exception) {   echo "uncaught exception: " , $exception->getmessage(), "\n";   error_log(.....$exception->getmessage().....); //yay goes file }  set_exception_handler('exception_handler');  throw new exception('uncaught exception'); echo "not executed\n"; ?> 

research further here


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -