Menu

#8 log.trace/debug/info... behaves differently depending on the appender

open
Tim Down
None
5
2014-02-18
2013-08-27
tetrode
No

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.

Related

Feature Requests: #8

Discussion

  • Tim Down

    Tim Down - 2013-08-29

    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.

     
  • tetrode

    tetrode - 2013-08-30

    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:

    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.


    Status: open
    Created: Tue Aug 27, 2013 02:49 PM UTC by tetrode
    Last Updated: Tue Aug 27, 2013 02:49 PM UTC
    Owner: Tim Down

    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.


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/log4javascript/feature-requests/8/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Feature Requests: #8


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.