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
5 Answers
Reset to default 10Take 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 :-)