16

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?

1

5 Answers 5

10

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

Sign up to request clarification or add additional context in comments.

2 Comments

Are there any examples where you can store the stacktrace to some datastore (ajax)?
stacktrace.js will not help you with window.onerror. It gives you the stack of the onerror, not the actual error. If you want the stack, you must try/catch. github.com/eriwen/javascript-stacktrace/issues/…
0

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

Comments

0

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.

Comments

-1

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.

Comments

-1

[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 :-)

3 Comments

needs a better site design.
It's NOT free. It's $14 a month.
It turned paid after I posted. Also I sold it a year ago or more.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.