jquery - A JavaScript frontend logging system that logs to our backend? -


we have established logging system our server-side services. specifically, our django project makes heavy use of python logging module, call calls logger.info(), logger.warn() , logger.error() picked our centralized logging system.

i equivalent on our frontend, , i've got few ideas:

  1. there sort of custom logging object exposed via javascript send messages backend via xmlhttprequest.

  2. i'd have equivalent logging levels on client-side: debug, info, warning , error.

  3. when we're developing locally (debug mode), i'd logging messages logged browser/firebug console via console.log().

  4. in production, debug messages should dropped completely.

  5. i recall seeing way capture uncaught javascript exceptions, these should logged @ error level.

  6. we're using google analytics event tracking, , it'd nice whatever system create tie somehow.

is idea? how this? there existing solutions?

(fwiw, we're using jquery on frontend.)

update: simplified question here: https://stackoverflow.com/questions/1423267/are-there-any-logging-frameworks-for-javascript

first, wrote , maintain log4javascript, i'm declaring interest front. use every day in work, have experience of user. here's how deal questions, relating log4javascript:

  1. use log4javascript's ajaxappender server logging;

  2. debug, info, warning , error supported, trace , fatal;

  3. use browserconsoleappender log firebug or native browser console;

  4. if don't want remove debug logging calls production code, can either adjust logger's threshold (using log.setlevel(log4javascript.level.error), example, suppress log calls priority less error). if want suppress logging calls, can drop in stub version of log4javascript in production code.

  5. you'll need write bit of code using window.onerror. window.onerror = function(msg, file, line) { log.error("error in " + file + " on line " + line + ": " + msg); }

  6. i'm not sure how want tie in google analytics. log4javascript has no particular support it.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -