I wrote recently about how to have your site(s) email you whenever a problem occurs. Trouble is "problem" turns out to be a rather broad scope. If you have a missing file or fundamental problem of some kind, you would want to know so you can fix it; if there was a dead link on your site, you would also want to fix it; if someone just mistypes the url (or follows a link from an outdated source) you may not want an email each time this happens. At some point in between reading the comment from (the esteemed) Dr Tarique Sani and deleting the 4000+ emails I received from my site in the meantime, I came to realize that there has to be a better way to record what errors are occurring on a site. So that's what I'll be talking about today ;).
Limiting Scope
When I reviewed the emails that my site has sent me in the past week, there were many duplicates. The cause for most of the generated errors were either links to old pages which don't exist anymore or have been moved, or broken links on the site. When I switched host I also changed from (case insensitive) php4 to (case sensitive) php5, this caused many links to stop working. I was glad to know of how and why these errors were occurring, but once would have been enough ;). Of the types of errors that can occur, there is one case in which I want an email every time it happens - if there is a missing connection (which should be rare to never). So changes have been made to check for and only email in this circumstance, for the rest of the time...
There was a time when this site was 100% xhtml valid. It didn't last long, as as soon as I forgot to correctly close a tag anywhere on the page, or added some beta-ish new functionality, or updated my cake version inevitably something became invalid. I used the Xhtml Validation helper for a while, but the messages it generated got in the way rather than helping. I still use it for certain tasks, such as checking comments and these blogs for well-formedness, it's a handy class of that there's no doubt but not the way I was trying to use it.
For this site my primary concern is that the code is at least well-formed and preferably 100% valid (xhtml). But rather than trust the W3 Validator to tell me my pages are fine; there's a much faster way to both detect and prompt fixing fundamental errors: Public Embarrassment.










