1 18 package org.apache.activemq.broker.util; 19 20 import org.apache.activemq.broker.BrokerPluginSupport; 21 import org.apache.activemq.broker.ConnectionContext; 22 import org.apache.activemq.broker.ConsumerBrokerExchange; 23 import org.apache.activemq.broker.ProducerBrokerExchange; 24 import org.apache.activemq.command.Message; 25 import org.apache.activemq.command.MessageAck; 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 36 public class LoggingBrokerPlugin extends BrokerPluginSupport { 37 38 private Log log = LogFactory.getLog(LoggingBrokerPlugin.class); 39 private Log sendLog = LogFactory.getLog(LoggingBrokerPlugin.class.getName()+".Send"); 40 private Log ackLog = LogFactory.getLog(LoggingBrokerPlugin.class.getName()+".Ack"); 41 42 public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { 43 if (sendLog.isInfoEnabled()) { 44 sendLog.info("Sending: " + messageSend); 45 } 46 super.send(producerExchange, messageSend); 47 } 48 49 public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception { 50 if (ackLog.isInfoEnabled()) { 51 ackLog.info("Acknowledge: " + ack); 52 } 53 super.acknowledge(consumerExchange, ack); 54 } 55 56 public Log getAckLog() { 59 return ackLog; 60 } 61 62 public void setAckLog(Log ackLog) { 63 this.ackLog = ackLog; 64 } 65 66 public Log getLog() { 67 return log; 68 } 69 70 public void setLog(Log log) { 71 this.log = log; 72 } 73 74 public Log getSendLog() { 75 return sendLog; 76 } 77 78 public void setSendLog(Log sendLog) { 79 this.sendLog = sendLog; 80 } 81 82 } 83 | Popular Tags |