I set up log4javascript logger with the following code:
var logger = log4javascript.getLogger(); var appender = new log4javascript.AjaxAppender('some url"); appender.setLayout(new log4javascript.JsonLayout(false, false)); appender.setSendAllOnUnload(true); //default true appender.setThreshold(log4javascript.Level.ERROR); logger.addAppender(appender); logger.error("test");
however, the JSON sent seems encoded. This is what I can read from firebug or IE dev toolbar:
data=%5B%7B%22logger%22%3A%22%5Banonymous%5D%22%2C%22timestamp%22%3A134303868
Do you have any suggestions? (I'm using the latest production version)
How to FIX:
1) write in JsonLayout class
this.returnsPostData = true;
2) remove the last 4 lines of code in PreparePostData to remove &layout=xx in the request body 3) change the content-type in sendRequest to
xmlHttp.setRequestHeader("Content-Type", appender.getLayout().getContentType());
Do you notice something wrong with this patch?
Log in to post a comment.
I set up log4javascript logger with the following code:
however, the JSON sent seems encoded. This is what I can read from firebug or IE dev toolbar:
Do you have any suggestions? (I'm using the latest production version)
How to FIX:
1) write in JsonLayout class
2) remove the last 4 lines of code in PreparePostData to remove &layout=xx in the request body
3) change the content-type in sendRequest to
Do you notice something wrong with this patch?