Search code examples
phpexceptionerror-handlingerror-log

Best Practices for Live Website Error Management


I am just about to launch a fairly large website for the first time. I have turned off all error messages in my php.ini and error messages are now logged to an "error_log" file on my server.

My question is, now that the errors are logged to a file, what are the best ways that web developers keep on top of seeing when/where errors occur on the website?

At the moment, it seems like the best way would be to constantly check the error_log file everyday, however this doesn't seem like the most efficient solution. Ideally I would receive an email everytime an error occurs (with the error message). Any advice on how I can keep on top of errors would be greatly appreciated!

Extra Info
Running on Shared Server (HostMonster)
Website Authored in PHP


Solution

  • There are two main functions in PHP that help catching errors and exceptions. I suggest that you take a look at them :

    In our company, we handle all errors that occurs on our websites with those functions, defining our own errors and exceptions handling methods.

    When an error occurs, an email is sent to the developers team.