View Full Version : Error Logging

07-01-2005, 05:39 AM
Anyone done this extensively, any tips?

07-01-2005, 12:13 PM
This question might be my first entry... ;)

07-01-2005, 02:33 PM
Error Logging Via what? I do all sorts of error logging for my internal website. If there is an ASP/PHP error then i log that and also send me an email. If there is an XML parsing error via the XMLHTTP request object, i store it to the database then send myself an email. If there is a problem with a certain section of code I just put a "Try/Catch" around it and send myself the same notes. Then in the database I write down when I fixed it and how. I donít know exactly what you want though? And error logger in JS? I just an XMLHTTP request object to do that. And if it fails for god knows what reason (We are only allowed to use IE5.5+ and MF 1.x) I have the page create an IFRAME and sends the information that way. And if for some reason that Fails i display an annoying message to the user telling them to contact me right away. Which does not disappear until they refresh the page.

But what exactly do you want / need. Most JS code should be written not to fail. You should be checking all your objects and variables as you go along. Have a function that should be accepting only strings?

function returnString( sStr ) {
if ( typeof sStr != 'string' ) return '';
return sStr;

You should be doing allot of checks inside your code to make sure there are minimal errors inside of it.

Sorry that this turned into a rant. But I have co workers that are the same way. SpiritOfGrandeur how do you check for errors in your JS. Once I sit down and teach them how to write good JS, their need for error reports mostly goes away. And if it doesnít I just tell them to run my function to report it to themselves ;)

07-06-2005, 02:02 PM
Nope, nothing to do with debugging code. I would explain but doubt it will accomplish anything here... :rolleyes:

07-06-2005, 02:46 PM
Again though you did not specify what exactly you wanted to log! What type of errors how are the errors happening?

07-06-2005, 04:25 PM
What does it matter, being a general thing? The error is abstract. The question was open ended: I no longer care.