AMQ-6389 - init the size attribute prior to logging a message send in the logging plugin

This commit is contained in:
gtully 2016-08-08 16:46:49 +01:00
parent 5e5b673afa
commit 9249315688
2 changed files with 10 additions and 1 deletions

View File

@ -276,6 +276,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
}
private void logSend(Message copy) {
copy.getSize();
Logger perDestinationsLogger = LOG;
if (isPerDestinationLogger()) {
ActiveMQDestination destination = copy.getDestination();

View File

@ -34,6 +34,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class AMQ3779Test {
@ -44,7 +45,8 @@ public class AMQ3779Test {
private BrokerService brokerService;
private Appender appender;
private final AtomicBoolean ok = new AtomicBoolean(false);
private final AtomicBoolean gotZeroSize = new AtomicBoolean(false);
@Before
public void setUp() throws Exception {
ok.set(false);
@ -55,6 +57,10 @@ public class AMQ3779Test {
if (event.getLoggerName().toString().contains(qName)) {
ok.set(true);
}
if (event.getMessage().toString().contains("Sending") && event.getMessage().toString().contains("size = 0")) {
gotZeroSize.set(true);
}
}
};
@ -100,5 +106,7 @@ public class AMQ3779Test {
connection.close();
assertTrue("got expected log message", ok.get());
assertFalse("did not get zero size in send message", gotZeroSize.get());
}
}