ARTEMIS-2840 missing AddressControl audit logging

This commit is contained in:
Justin Bertram 2020-07-09 11:33:47 -05:00 committed by Clebert Suconic
parent a45f383e1a
commit 4c79b25dc2
2 changed files with 49 additions and 0 deletions

View File

@ -2695,5 +2695,38 @@ public interface AuditLogger extends BasicLogger {
@Message(id = 601730, value = "User {0} is enabling on target resource: {1} {2}", format = Message.Format.MESSAGE_FORMAT)
void enable(String user, Object source, Object... args);
static void pauseAddressSuccess(String queueName) {
RESOURCE_LOGGER.pauseAddressSuccess(getCaller(), queueName);
}
@LogMessage(level = Logger.Level.INFO)
@Message(id = 601731, value = "User {0} has paused address {1}", format = Message.Format.MESSAGE_FORMAT)
void pauseAddressSuccess(String user, String queueName);
static void pauseAddressFailure(String queueName) {
RESOURCE_LOGGER.pauseAddressFailure(getCaller(), queueName);
}
@LogMessage(level = Logger.Level.INFO)
@Message(id = 601732, value = "User {0} failed to pause address {1}", format = Message.Format.MESSAGE_FORMAT)
void pauseAddressFailure(String user, String queueName);
static void resumeAddressSuccess(String queueName) {
RESOURCE_LOGGER.resumeAddressSuccess(getCaller(), queueName);
}
@LogMessage(level = Logger.Level.INFO)
@Message(id = 601733, value = "User {0} has resumed address {1}", format = Message.Format.MESSAGE_FORMAT)
void resumeAddressSuccess(String user, String queueName);
static void resumeAddressFailure(String queueName) {
RESOURCE_LOGGER.resumeAddressFailure(getCaller(), queueName);
}
@LogMessage(level = Logger.Level.INFO)
@Message(id = 601734, value = "User {0} failed to resume address {1}", format = Message.Format.MESSAGE_FORMAT)
void resumeAddressFailure(String user, String queueName);
}

View File

@ -413,6 +413,14 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
addressInfo.setPostOffice(server.getPostOffice());
addressInfo.setStorageManager(server.getStorageManager());
addressInfo.pause(persist);
if (AuditLogger.isResourceLoggingEnabled()) {
AuditLogger.pauseAddressSuccess(addressInfo.getName().toString());
}
} catch (Exception e) {
if (AuditLogger.isResourceLoggingEnabled()) {
AuditLogger.pauseAddressFailure(addressInfo.getName().toString());
}
throw e;
} finally {
blockOnIO();
}
@ -431,6 +439,14 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
addressInfo.setPostOffice(server.getPostOffice());
addressInfo.setStorageManager(server.getStorageManager());
addressInfo.resume();
if (AuditLogger.isResourceLoggingEnabled()) {
AuditLogger.resumeAddressSuccess(addressInfo.getName().toString());
}
} catch (Exception e) {
if (AuditLogger.isResourceLoggingEnabled()) {
AuditLogger.resumeAddressFailure(addressInfo.getName().toString());
}
throw e;
} finally {
blockOnIO();
}