log4javascript's AjaxAppender can be used to send log messages to the server.
var log = log4javascript.getLogger("serverlog");
var ajaxAppender = new log4javascript.AjaxAppender("http://example.com/clientlogger");
log.addAppender(ajaxAppender);
You could put informational logging calls in your code and add a window.onerror
handler to catch errors not caught by try/catch
blocks in your code:
window.onerror = function(errorMsg, url, lineNumber) {
log.fatal("Uncaught error " + errorMsg + " in " + url + ", line " + lineNumber);
};
You will also need to create something on the server to process the logging requests from the browser.
Full disclosure: I am the author of log4javascript.