Reputation: 2358
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?
Upvotes: 16
Views: 7160
Reputation: 142
[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 :-)
Upvotes: -1
Reputation: 92925
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.
Upvotes: 0
Reputation: 2168
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.
Upvotes: -1
Reputation: 15600
ExceptionHub is another good drop-in (paid) service that logs JS errors, with stack traces, groups them, etc.
Upvotes: 0