ARTEMIS-2385 Log header for rejecting message with too large header

Use warning level to add in the log the ID and debug level to add in the
log the message header of rejecting message with too large header.
This commit is contained in:
brusdev 2019-06-19 17:55:09 +02:00 committed by Justin Bertram
parent b771a2a399
commit 9d12ad6501
3 changed files with 12 additions and 1 deletions

View File

@ -556,6 +556,12 @@ public class JournalStorageManager extends AbstractJournalStorageManager {
final int messageEncodeSize = largeMessage.getEncodeSize();
if (messageEncodeSize > maxRecordSize) {
ActiveMQServerLogger.LOGGER.messageWithHeaderTooLarge(largeMessage.getMessageID(), logger.getName());
if (logger.isDebugEnabled()) {
logger.debug("Message header too large for " + largeMessage);
}
throw ActiveMQJournalBundle.BUNDLE.recordLargerThanStoreMax(messageEncodeSize, maxRecordSize);
}
}

View File

@ -2002,4 +2002,9 @@ public interface ActiveMQServerLogger extends BasicLogger {
@LogMessage(level = Logger.Level.INFO)
@Message(id = 224098, value = "Received a vote saying the backup is live with connector: {0}", format = Message.Format.MESSAGE_FORMAT)
void qourumBackupIsLive(String liveConnector);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 224099, value = "Message with ID {0} has a header too large. More information available on debug level for class {1}",
format = Message.Format.MESSAGE_FORMAT)
void messageWithHeaderTooLarge(Long messageID, String loggerClass);
}

View File

@ -285,7 +285,7 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
connection.connect();
final int strLength = 1024 * 1024;
final int strLength = 512 * 1024;
AmqpSession session = connection.createSession();
AmqpSender sender = session.createSender(testQueueName);