<div dir="ltr"><br><div>FWIW, you might want to read Jim Evans on the subject: <a href="http://jimevansmusic.blogspot.com/2013/09/capturing-javascript-errors-in.html">http://jimevansmusic.blogspot.com/2013/09/capturing-javascript-errors-in.html</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 3:39 PM, Gergo Tisza <span dir="ltr"><<a href="mailto:gtisza@wikimedia.org" target="_blank">gtisza@wikimedia.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> On Tue, Feb 24, 2015 at 2:53 AM, Sam Smith <samsmith <at> <a href="http://wikimedia.org" target="_blank">wikimedia.org</a>><br>
<br>
<br>
I'm working on adding generic Javascript error logging to the Wikimedia<br>
cluster. I hope to make it work reliably on the beta cluster within a week<br>
or two, and deploy it to production some time next quarter, so this might<br>
or might not be useful to you depending on where and how urgently you need<br>
error logging.<br>
<br>
There is an RfC [1] which is somewhat outdated but gives a good overview of<br>
what are the moving parts of an error logging system. Since then we have<br>
decided to use Sentry [2] as the error aggregator/user interface. That's<br>
not well documented yet, but there is an infrastructure plan at [3] and a<br>
demo page at [4]. You can follow current work in [5].<br>
<span class=""><br>
<br>
> >> 2. Is it possible?<br>
> > Sure. See GlobalEventHandlers.onerror [1].<br>
<br>
</span>The short answer is that it's possible but not necessarily easy. The long<br>
answer is outlined in the RfC.<br>
<span class=""><br>
> >> 3. How would we do it?<br>
<br>
</span>The big problem with global error logging is how to differentiate between<br>
your errors and errors caused by other components/site<br>
customizations/browser extensions/etc. If you want to log browser tests<br>
errors in a controlled environment, this is less of a problem; if you want<br>
to log live errors, the records that are interesting to you will be a<br>
fraction of the total logs.<br>
<br>
At the moment, I don't have a good solution for this; identifying where an<br>
error originates from is going to be hard until ResourceLoader gets source<br>
map support, which is several quarters away.<br>
<br>
If you can live with this limitation, error reporting should Just Work<br>
(once Sentry has been deployed). Otherwise, you can add try-catch blocks<br>
manually and then tag the errors with the module name or other identifying<br>
information - there will be helper functions to do that and to report the<br>
errors which are caught.<br>
<span class=""><br>
<br>
Jon Robson <jrobson@...> writes:<br>
> I wonder is if the browser tests can log any JavaScript console errors<br>
> it encounters during test runs somewhere. This would be added<br>
> protection for us to prevent errors leaking into production. I've<br>
> cc'ed QA in case they have any ideas about that.<br>
<br>
</span>This should be pretty simple to set up once the core patches for JS error<br>
logging [6] are merged. If you want the errors in Sentry just make sure<br>
Jenkins enables the Sentry extension and sets a few site config vars. If<br>
you want them in the test artifacts, I'm not sure a clean solution exists<br>
for that, but since the exceptions will be published in the<br>
errorLogging.exception mw.track event stream, one could write a small<br>
MediaWiki extension which stores that in a cookie / localstorage from where<br>
they can be retrieved at the end of the test.<br>
<br>
<br>
[1] <a href="https://www.mediawiki.org/wiki/Requests_for_comment/Server-" target="_blank">https://www.mediawiki.org/wiki/Requests_for_comment/Server-</a><br>
side_Javascript_error_logging<br>
[2] <a href="https://getsentry.com/welcome/" target="_blank">https://getsentry.com/welcome/</a><br>
[3]<br>
<a href="https://docs.google.com/a/wikimedia.org/presentation/d/1kdSdtLFev6r9rirI35n
9QUrU9-3J5XgYk00vDJrqISI/edit" target="_blank">https://docs.google.com/a/wikimedia.org/presentation/d/1kdSdtLFev6r9rirI35n<br>
9QUrU9-3J5XgYk00vDJrqISI/edit</a><br>
[4] <a href="http://sentry-beta.wmflabs.org/jserrors/jserrors/group/15/" target="_blank">http://sentry-beta.wmflabs.org/jserrors/jserrors/group/15/</a><br>
[5] <a href="https://phabricator.wikimedia.org/T1345" target="_blank">https://phabricator.wikimedia.org/T1345</a><br>
[6]<br>
<a href="https://gerrit.wikimedia.org/r/#/q/status:open+project:mediawiki/core+branc
h:master+topic:js-errorlogging,n,z" target="_blank">https://gerrit.wikimedia.org/r/#/q/status:open+project:mediawiki/core+branc<br>
h:master+topic:js-errorlogging,n,z</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
QA mailing list<br>
<a href="mailto:QA@lists.wikimedia.org">QA@lists.wikimedia.org</a><br>
<a href="https://lists.wikimedia.org/mailman/listinfo/qa" target="_blank">https://lists.wikimedia.org/mailman/listinfo/qa</a><br>
</div></div></blockquote></div><br></div>