Results 1 to 5 of 5

Thread: Logging client side errors to server?

  1. #1
    Join Date
    Aug 2012

    Logging client side errors to server?

    Someone in the company thinks it is going to be a good idea to log client side (javascript) errors to the server. No one on the team thinks it is a good idea but need to come up with enough reasons as to why not.

    After some research there is no real magic way to do it aside from an ajax back to the server - so will incur performance overhead.

    Seen some older posts overriding window.onerror instead of try catch everywhere (and then make an ajax call in there that posts error message to server) but have seen some comments that window.onerror no longer works in some browsers - is this true?

    In summary, is there a clean way to do this that would not a.) impact performance or b.)muck up original javascript code with a bunch of try catch's etc. and c.) will work cross platform on modern browsers and d.) has very minimal chance of causing any other headaches? Thanks!

  2. #2
    Join Date
    Aug 2007
    Well for one someone could just spam your error log by running javascript errors in the console. You could also end up with errors in extensions that people are running (nothing to do with your app) and so on.

    I imagine the best way would be to wrap whatever initialisation you do in a try...catch although I gather you can set the error handler in JS.

    Here's a good article: http://www.alistapart.com/articles/m...ps-and-tricks/

  3. #3
    Join Date
    Aug 2012
    Thanks so much for the reply - great points.

    Though I am getting a 404 for your link - are you sure it is correct?

    Thanks again!

  4. #4
    Join Date
    Jul 2008
    urbana, il
    you can use IMG pings instead of ajax; much lighter for the client to issue.

    new Image().src="http://log.myco.com/?loc="+location.href+"&msg="+e.message;
    Last edited by rnd me; 08-16-2012 at 03:40 PM.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

  5. #5
    Join Date
    Sep 2008

    Thumbs up A plug and play service

    I've created a plug and play service, that does what you ask.
    You can find at http://muscula.com
    For now it's free, it's in beta. If you sign up I will give you access fast.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center