Is it possible to send an automatic email that includes details about the requested page to the webmaster when a visitors hits a 500 internal server error page? That way the web master could act more quickly to solve the problem. This is a general question so which platform is used is irrelelevant.
feedback
|
|
Yes, it's possible. You just need to ascertain whether the web server is IIS or Apache and then you can set it to show a custom page (which will contain the code to capture the details you want from the user and e-mail it to you) whenever a 500 error is encountered. For Apache, for instance, it's really simple. Simply create (or add if one exists) a
| |||
|
feedback
|
|
Sending a mail with every error, via a custom error page, may not work if the problem is with PHP related: your custom page may not run either so the mail doesn't go out. Also you'll get one email per error which could be a flood. I'd suggest instead implementing some form of log scanning: have a cron job (or scheduled task under Windows) scan the log files for errors every day or every few hours and send a summary of anything found since the last check to the relevant admin(s). You could also make your log checking script do a few other things like make sure the web server service (and any database services and so forth) is running, if only for paranoia's sake. If nothing else, one email per reporting period can cover other HTTP error codes (401, 404, ...) and other things found in the logs. If you do this, always send the email message even if nothing is wrong: that way you know if your scanning script has failed to run because you stop getting messages (otherwise no message could either mean all is well or the damage report machine is damaged). | |||||
feedback
|
|
Yes, very possible. Except email, you can also check Web Server log. I suggest don't send email on every single 500, otherwise if theres a bug, you mailbox will get flooded. Just record the error id, send 1 for the same error on same id. | |||||
feedback
|
|
Yes, send an email for every error. It's also a good idea to send as much info as you can get as part of the email. Think about grabbing:
This helps greatly for debugging purposes. It's trivial to get this info in classic ASP and ASP.NET via the Request and Session objects. Just don't have an error on your custom error page, or you'll freak out the web server. | |||
|
feedback
|
