Friday, April 20, 2007

error handling system for web applications

managing web applications have never been so easy. the external / internal errors which occurs all the time due to DB connection failure or some other 3rd party service connection failure which are so hard to predict.

i was always been thinking about this issue. many experts suggested that we should e-mail the error with relevant information to sys administrator or someone who's responsible. but sometimes it is not so easy to do so. because most of the time the errors are reciprocal (means one error leads to another and it leads to another and the chain continues)

and by the way most of the people now use RSS feeds to get to know what is happening all over the internet rather than searching and browsing the web.

so what i was thinking about is to log all the errors in a database table rather than the plain text file. to accomplish that task in PHP you can simply use the function set_error_handler and from there define a function which can insert that specific errors details into the DB. after that we can have separate PHP file which can generate a dynamic RSS file containing the latest error messages on request and which supports some kind of authentication.

and simply from there onwards you can add that link to your favorite RSS reader, and then you can be simply informed about all those error messages which occurred within the application you provided to the customer.

and if you wish to further this error handling system you can separate FATAL errors, WARNINGS and NOTICES or a custom clarification of all the error messages.

praveen gunasekara.
"technology reinvented"

No comments: