ARTEMIS-3379 add message details to consumer audit log

This commit is contained in:
Justin Bertram 2021-07-06 13:07:49 -05:00 committed by clebertsuconic
parent d800957bfb
commit 9f96e2d270
2 changed files with 5 additions and 5 deletions

View File

@ -2428,13 +2428,13 @@ public interface AuditLogger extends BasicLogger {
void logCoreSendMessage(String user, String messageToString, Object context); void logCoreSendMessage(String user, String messageToString, Object context);
//hot path log using a different logger //hot path log using a different logger
static void coreConsumeMessage(Subject user, String queue) { static void coreConsumeMessage(Subject user, String queue, String message) {
MESSAGE_LOGGER.consumeMessage(getCaller(user), queue); MESSAGE_LOGGER.consumeMessage(getCaller(user), queue, message);
} }
@LogMessage(level = Logger.Level.INFO) @LogMessage(level = Logger.Level.INFO)
@Message(id = 601501, value = "User {0} is consuming a message from {1}", format = Message.Format.MESSAGE_FORMAT) @Message(id = 601501, value = "User {0} is consuming a message from {1}: {2}", format = Message.Format.MESSAGE_FORMAT)
void consumeMessage(String user, String address); void consumeMessage(String user, String address, String message);
/* /*
* This logger is focused on user interaction from the console or thru resource specific functions in the management layer/JMX * This logger is focused on user interaction from the console or thru resource specific functions in the management layer/JMX

View File

@ -494,7 +494,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
Message message = reference.getMessage(); Message message = reference.getMessage();
if (AuditLogger.isMessageEnabled()) { if (AuditLogger.isMessageEnabled()) {
AuditLogger.coreConsumeMessage(session.getRemotingConnection().getAuditSubject(), getQueueName().toString()); AuditLogger.coreConsumeMessage(session.getRemotingConnection().getAuditSubject(), getQueueName().toString(), reference.toString());
} }
if (server.hasBrokerMessagePlugins()) { if (server.hasBrokerMessagePlugins()) {
server.callBrokerMessagePlugins(plugin -> plugin.beforeDeliver(this, reference)); server.callBrokerMessagePlugins(plugin -> plugin.beforeDeliver(this, reference));