You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2010/05/04 19:04:24 UTC

DO NOT REPLY [Bug 49247] New: Add option for persistent/non-persistent delivery in JMSAppender

https://issues.apache.org/bugzilla/show_bug.cgi?id=49247

           Summary: Add option for persistent/non-persistent delivery in
                    JMSAppender
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: vandezuma@gmail.com


Add a boolean property to org.apache.log4j.net.JMSAppender that will specify if
messages should be sent in persistent delivery mode.  In high-volume
applications, persistent delivery (currently the default) can cause performance
problems on the JMS server.

Suggested code changes:

...
boolean persistentDelivery = false;  // add getters/setters
...


  /**
     This method called by {@link AppenderSkeleton#doAppend} method to
     do most of the real appending work.  */
  public void append(LoggingEvent event) {
    if(!checkEntryConditions()) {
      return;
    }

    try {
      ObjectMessage msg = topicSession.createObjectMessage();
      if(locationInfo) {
    event.getLocationInformation();
      }
      msg.setObject(event);

      /****** Enhancement - check for persistent delivery ******/
      msg.setJMSDeliveryMode(persistentDelivery ? 
           DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
      /****** End of enhancement ******/

      topicPublisher.publish(msg);
    } catch(JMSException e) {
      errorHandler.error("Could not publish message in JMSAppender
["+name+"].", e,
             ErrorCode.GENERIC_FAILURE);
    } catch(RuntimeException e) {
      errorHandler.error("Could not publish message in JMSAppender
["+name+"].", e,
             ErrorCode.GENERIC_FAILURE);
    }
  }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 49247] Add option for persistent/non-persistent delivery in JMSAppender

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49247

--- Comment #1 from Scott Vandezande <va...@gmail.com> 2010-05-04 14:17:12 EDT ---
Just discovered, you have to also set the delivery mode on the topicSender:

in activateOptions():

     topicPublisher = topicSession.createPublisher(topic); //existing

     topicPublisher.setDeliveryMode(this.persistentDelivery ? 
              DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org