Discussion:
Server side Javascript logging
Jesper
2009-01-13 13:43:55 UTC
Permalink
Hi MochiKit people,

I am a happy MochiKit and Javascript amateur using MochiKit for my
personal marine weather forecast site:

http://www.worldwildweather.com

(I am still struggling with a few Javascript issues so please do not
kill me if it does not work)

During the real world testing of my web site my users have encountered
some Javascript errors. To facilitate debugging and to build a more
robust application I would like to log Javascript errors and info
(using MochiKit.Logging) and send it back to my server for analysis.

Has anyone got an example showing how this is done or maybe just some
pointers to get me started.

Best regards,
Jesper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
n***@gmail.com
2009-01-14 10:15:25 UTC
Permalink
Ajax.

Catch the JavaScript errors with a try-catch construction, and send
the catched error to a "logging" URL on your server, like:

http://www.worldwildweather.com/log.php?message=<catched error
message>

Niek
Post by Jesper
Hi MochiKit people,
I am a happy MochiKit and Javascript amateur using MochiKit for my
http://www.worldwildweather.com
(I am still struggling with a few Javascript issues so please do not
kill me if it does not work)
During the real world testing of my web site my users have encountered
some Javascript errors. To facilitate debugging and to build a more
robust application I would like to log Javascript errors and info
(using MochiKit.Logging) and send it back to my server for analysis.
Has anyone got an example showing how this is done or maybe just some
pointers to get me started.
Best regards,
Jesper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Jesper
2009-01-15 08:32:29 UTC
Permalink
Hi Niek,
Post by n***@gmail.com
Catch the JavaScript errors with a try-catch construction, and send
http://www.worldwildweather.com/log.php?message=<catched error
message>
Thanks, I will definitely do that. I guess that I can use the MochiKit
logging method:

var msg = logger.getMessageText();

to send the get all logged information (although I might need to
either put a limit on the size of the message or use a post request).

I would definitely also want to catch unanticipated errors. Would you
do that by putting the entire onload method in a try-catch
construction where the error is reraised (since I would of course not
just cause my users browsers to silently ignore an error) after
sending a log to my server:

window.onload = function() {
try {
...
} catch(error) {
var msg = logger.getMessageText();
sendToMyServer(msg);
throw error;
};
};

Or do you have a better approach?

Best regards,
Jesper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
n***@gmail.com
2009-01-15 08:48:28 UTC
Permalink
First - I would always use POST for this.

If you catch error, shouldn't you use the message of "error"? Not
anything you've logged...

Re-trowing the error is a good idea, nothing changes for the end user.
Post by Jesper
Hi Niek,
Post by n***@gmail.com
Catch the JavaScript errors with a try-catch construction, and send
http://www.worldwildweather.com/log.php?message=<catched error
message>
Thanks, I will definitely do that. I guess that I can use the MochiKit
var msg = logger.getMessageText();
to send the get all logged information (although I might need to
either put a limit on the size of the message or use a post request).
I would definitely also want to catch unanticipated errors. Would you
do that by putting the entire onload method in a try-catch
construction where the error is reraised (since I would of course not
just cause my users browsers to silently ignore an error) after
window.onload = function() {
  try {
    ...
  } catch(error) {
    var msg = logger.getMessageText();
    sendToMyServer(msg);
    throw error;
  };
};
Or do you have a better approach?
Best regards,
Jesper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
troels knak-nielsen
2009-01-15 09:18:44 UTC
Permalink
You can try hooking a handler up to window.onerror although this chart
suggests that it may only work on certain browsers:

http://www.quirksmode.org/dom/events/index.html

Maybe there are some browser-specific alternatives for those that
don't support this.

--
troels
Post by n***@gmail.com
First - I would always use POST for this.
If you catch error, shouldn't you use the message of "error"? Not
anything you've logged...
Re-trowing the error is a good idea, nothing changes for the end user.
Post by Jesper
Hi Niek,
Post by n***@gmail.com
Catch the JavaScript errors with a try-catch construction, and send
http://www.worldwildweather.com/log.php?message=<catched error
message>
Thanks, I will definitely do that. I guess that I can use the MochiKit
var msg = logger.getMessageText();
to send the get all logged information (although I might need to
either put a limit on the size of the message or use a post request).
I would definitely also want to catch unanticipated errors. Would you
do that by putting the entire onload method in a try-catch
construction where the error is reraised (since I would of course not
just cause my users browsers to silently ignore an error) after
window.onload = function() {
try {
...
} catch(error) {
var msg = logger.getMessageText();
sendToMyServer(msg);
throw error;
};
};
Or do you have a better approach?
Best regards,
Jesper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Jesper
2009-01-15 09:55:40 UTC
Permalink
Hi again,
Post by n***@gmail.com
First - I would always use POST for this.
I agree. From the documentation it seems like I can use:

MochiKit.Async.doXHR(...)

for this.
Post by n***@gmail.com
If you catch error, shouldn't you use the message of "error"? Not
anything you've logged...
Yes, I forgot to include that (but I would also like to transmit
available logging information for easier debugging).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Dumitru Glavan
2013-05-26 16:20:29 UTC
Permalink
You might try JSlogger <http://jslogger.com> - we built it exactly for the
same reason. We have a couple of single page apps in production with heavy
Javascript and we have to log all the exceptions out there. It supports
mobile devices as well and backend logging through NodeJS. So far, we are
happy with it. Worth to give it a try.
Post by Jesper
Hi MochiKit people,
I am a happy MochiKit and Javascript amateur using MochiKit for my
http://www.worldwildweather.com
(I am still struggling with a few Javascript issues so please do not
kill me if it does not work)
During the real world testing of my web site my users have encountered
some Javascript errors. To facilitate debugging and to build a more
robust application I would like to log Javascript errors and info
(using MochiKit.Logging) and send it back to my server for analysis.
Has anyone got an example showing how this is done or maybe just some
pointers to get me started.
Best regards,
Jesper
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mochikit+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mochikit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Troels Knak-Nielsen
2013-05-26 17:34:44 UTC
Permalink
Really? This thread is more than 4 years old. I'm sure jslogger is a fine
product, but this is just border line of spam.
Post by Dumitru Glavan
You might try JSlogger <http://jslogger.com> - we built it exactly for
the same reason. We have a couple of single page apps in production with
heavy Javascript and we have to log all the exceptions out there. It
supports mobile devices as well and backend logging through NodeJS. So far,
we are happy with it. Worth to give it a try.
Post by Jesper
Hi MochiKit people,
I am a happy MochiKit and Javascript amateur using MochiKit for my
http://www.worldwildweather.**com <http://www.worldwildweather.com>
(I am still struggling with a few Javascript issues so please do not
kill me if it does not work)
During the real world testing of my web site my users have encountered
some Javascript errors. To facilitate debugging and to build a more
robust application I would like to log Javascript errors and info
(using MochiKit.Logging) and send it back to my server for analysis.
Has anyone got an example showing how this is done or maybe just some
pointers to get me started.
Best regards,
Jesper
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at http://groups.google.com/group/mochikit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mochikit+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mochikit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Dumitru Glavan
2013-05-26 20:27:08 UTC
Permalink
Sorry, was just helping out :) Didn't notice the date...
Post by Troels Knak-Nielsen
Really? This thread is more than 4 years old. I'm sure jslogger is a fine
product, but this is just border line of spam.
Post by Dumitru Glavan
You might try JSlogger <http://jslogger.com> - we built it exactly for
the same reason. We have a couple of single page apps in production with
heavy Javascript and we have to log all the exceptions out there. It
supports mobile devices as well and backend logging through NodeJS. So far,
we are happy with it. Worth to give it a try.
Post by Jesper
Hi MochiKit people,
I am a happy MochiKit and Javascript amateur using MochiKit for my
http://www.worldwildweather.**com <http://www.worldwildweather.com>
(I am still struggling with a few Javascript issues so please do not
kill me if it does not work)
During the real world testing of my web site my users have encountered
some Javascript errors. To facilitate debugging and to build a more
robust application I would like to log Javascript errors and info
(using MochiKit.Logging) and send it back to my server for analysis.
Has anyone got an example showing how this is done or maybe just some
pointers to get me started.
Best regards,
Jesper
--
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To unsubscribe from this group and stop receiving emails from it, send an
.
Visit this group at http://groups.google.com/group/mochikit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mochikit+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mochikit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Continue reading on narkive:
Loading...