Menu

Problems with AjaxAppender

Help
Abo
2011-08-18
2013-04-29
  • Abo

    Abo - 2011-08-18

    Great tool & thanks for writing it!

    I have 2  problems with AjaxAppender.

    First of all, by default I only get very limited data being sent to the server - no date or time - which I thought was default with HttpPostLayout.

    Secondly, when I try to set the layout myself:

    var log = log4javascript.getDefaultLogger();
    var ajApp = new log4javascript.AjaxAppender("appender.php");
    ajApp.setLayout(new log4javascript.PatternLayout("%d{HH:mm:ss} %-5p - %m%n"));
    log.addAppender(ajApp);
    

    I get a javascript error on page load:

    Uncaught ReferenceError: loggingEvent is not defined
    preparePostDatalog4javascript.js:168
    sendAlllog4javascript.js:163
    appendlog4javascript.js:186
    Appender.doAppendlog4javascript.js:89
    callAppenderslog4javascript.js:73
    loglog4javascript.js:73
    timeEndlog4javascript.js:75
    (anonymous function)jqtest2.js:56
    f.extend._Deferred.e.resolveWithjquery.min.js:16
    f.e.extend.readyjquery.min.js:16
    f.c.addEventListener.Bjquery.min.js:16
    

    Would appreciate any help.

    Thanks

    Abo

     
  • Tim Down

    Tim Down - 2011-08-23

    By default, HttpPostDataLayout sends the date as the "timestamp" parameter. The value is a number representing the number of milliseconds elapsed since January 1st 1970, like the value you get from the getTime() method of Date objects in JavaScript.

    The problem you're getting with PatternLayout is a bug in the AjaxAppender that is fixed in the next version (which I've been developing on and off for a while). I can send you a patched version of 1.4.1 if you need.

    Tim

     

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.