最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Log javascript error - Stack Overflow

programmeradmin4浏览0评论

I want to log all JS errors in my project during the beta-testing time. Now I do it in the following way:

window.onerror = myErrHandler;

function myErrHandler(message, url, line)
{
    $.ajax({
        cache: false,
        type: "post",
        data: {error:message, url:url, line:line, brouser:navigator.userAgent},
        url: "/Home/LogJavaScript/",
        async: true
    });
    return true;
}

But this way couldn't help to get any information about call stack. So, information about errors inside jQuery or any other outer scripts couldn't help a lot.

Is there any way to improve such logging?

I want to log all JS errors in my project during the beta-testing time. Now I do it in the following way:

window.onerror = myErrHandler;

function myErrHandler(message, url, line)
{
    $.ajax({
        cache: false,
        type: "post",
        data: {error:message, url:url, line:line, brouser:navigator.userAgent},
        url: "/Home/LogJavaScript/",
        async: true
    });
    return true;
}

But this way couldn't help to get any information about call stack. So, information about errors inside jQuery or any other outer scripts couldn't help a lot.

Is there any way to improve such logging?

Share Improve this question asked Apr 30, 2012 at 11:15 Sir HallySir Hally 2,3583 gold badges32 silver badges48 bronze badges 1
  • 3 :this link would help stackoverflow.com/questions/147891/… – dhinesh Commented Apr 30, 2012 at 11:41
Add a comment  | 

5 Answers 5

Reset to default 10

Take a look at stacktrace.js, that should do the trick.

ExceptionHub is another good drop-in (paid) service that logs JS errors, with stack traces, groups them, etc.

You could also try https://www.atatus.com/. Along with stack traces, Atatus captures all of your visitors' actions in one clear picture which lead to the error. Apart from JavaScript error tracking, Atatus also provides Real User Monitoring, AJAX(XHR) Monitoring and Transactions monitoring.

Take a look at JsLog.me service. It catches errors and collects whole client logs which can be helpful for recovering bug reproduction while beta-testing. Also it works for hybrid (PhoneGap/Cordova) applications.

[EDIT]: This project was sold long ago and is a paid service now.

You could also take a look at my project called Muscula that logs your JavaScript errors It's easy to set up, just add a script snippet and you're logging. It's free :-)

发布评论

评论列表(0)

  1. 暂无评论