log.trace/debug/info... behaves differently depending on the appender
Brought to you by:
timdown
When sending a javascript object to logger The PopUpAppender/InPageAppender will show the full object using JSON notation:
setPushMethod {
userGroup: 17,
identification: 25,
language: English
}
While the AjaxAppender will display this as
setPushMethod,[object Object]
javascript statement used:
log.trace("setPushMethod", oContext);
removing the first argument doese not have an influence.
Not sure whether this is a bug or as designed, but it would help me tremendously if this could be changed.
This happens because by default the PopUp/InPageAppender use a PatternLayout, which defaults to formatting objects with one level of expansion (although this is configurable) whereas AjaxAppender by default uses an HttpPostDataLayout, which does no object expansion. I would suggest working around this by simply calling JSON.stringify() on the object before passing it to the logger.
Fundamentally, I see the format of log messages as being mostly the responsibility of the developer, although I can see the argument for adding configurability for how objects are expanded. I'll think about this for version 2.0; my current development version has Renderers, which are similar to Renderers in log4j.
Hmm, OK I think you are right there for the workaround; I could easily do a
stringify to solve this. As long as this remains working in the other
scenario (Popup/InPage) this will be no issue; just some extra coding. I'll
digg deeper into this.
Thanks for your insight!
Mark
On Fri, Aug 30, 2013 at 1:14 AM, Tim Down timdown@users.sf.net wrote:
Related
Feature Requests: #8