Real-time Error Management Best Practices

I'm just about to launch a rather large site for the first time. I disabled all error messages in my php.ini and error messages are now logged in the "error_log" file on my server.

My question is: now that errors are recorded in the file, which web developers are best able to see when / where errors occur on the website ?

At the moment, it seems that the best way is to constantly check the error_log file every day, however this does not seem to be the most effective solution. Ideally, I get an email every time an error occurs (with an error message). Any advice on how I can support bugs would be greatly appreciated!

Additional Information
Work on a shared server (HostMonster)
Website Created in PHP

+6
php exception-handling error-handling error-log
source share
5 answers

PHP has two main functions that help you catch errors and exceptions. I suggest you take a look at them:

In our company, we process all errors that occur on our sites with these functions, defining our own errors and exception handling methods.

If an error occurs, the email is sent to the development team.

+5
source share

The place I was working on previously used a custom extension to handle error logging. These are basically INSERT DELAY errors in the database with some additional information. Then a separate administrative tool was written, which makes it easy to find, view, sort, and manually crop the log table.

I recommend that you do not write a custom extension, but you use the set_error_handler method and just write to the database. If the database is not available, write to the file as a backup. It will be a world easier than dealing with a huge file and a one-time format.

If you want, you can also email hourly resumes, but I do not suggest sending you anything more, or you will hate yourself.

+2
source share

You can send e-mail messages yourself if there was no e-mail in the last N hours.

0
source share

If you don’t expect a lot of mistakes, the “private” RSS / ATOM feed may work well ... you don’t need to worry if you don’t get anything ... but if you start receiving “updates” you know that there are problems .

0
source share

I don't know how Hostmonster handles log rotation, but usually you want to track the size of your error_log file. If the size suddenly accumulates, you definitely need to check something, so you want to receive an email saying that the size of the log file unexpectedly unexpectedly outgrew.

In addition, you can combine error logs at the end of the week and email them to yourself and debug the weekend. If the error only occurs several times a week, perhaps this is not a problem too .

0
source share

All Articles