Reputation: 13804
I want to know how I can display E_ERROR
error messages to the screen but write E_ALL
error messages to the error log, we currently use the error_reporting()
in our app index page so we can change error reporting without the need to constantly restart the web server, but it seems that this (or perhaps the way it's meant to work) means that we only log errors that we see on the screen.
Is there a way to log and display different levels of errors?
Cheers!
Upvotes: 4
Views: 749
Reputation: 724462
You could make a custom error handler, and in your error handler check if the error is an E_ERROR
; if so, print it out. Then log the error, regardless of whether it is an E_ERROR
or not.
If you're not familiar with custom error handling, the PHP manual has a good example on how to use an error handler to do different things depending on the nature of a PHP error.
Upvotes: 1