Commit e272a28e by Maxim Neaga Committed by Madhan Neethiraj

ATLAS-2958: updated hooks to log exceptions on all notification failures

parent 243a4321
......@@ -172,9 +172,8 @@ public abstract class AtlasHook {
return;
}
final int maxAttempts = maxRetries < 1 ? 1 : maxRetries;
final String message = messages.toString();
Exception notificationFailure = null;
final int maxAttempts = maxRetries < 1 ? 1 : maxRetries;
Exception notificationFailure = null;
for (int numAttempt = 1; numAttempt <= maxAttempts; numAttempt++) {
if (numAttempt > 1) { // retry attempt
......@@ -214,14 +213,16 @@ public abstract class AtlasHook {
}
}
if (shouldLogFailedMessages && notificationFailure instanceof NotificationException) {
final List<String> failedMessages = ((NotificationException) notificationFailure).getFailedMessages();
if (notificationFailure != null) {
if (shouldLogFailedMessages && notificationFailure instanceof NotificationException) {
final List<String> failedMessages = ((NotificationException) notificationFailure).getFailedMessages();
for (String msg : failedMessages) {
logger.log(msg);
for (String msg : failedMessages) {
logger.log(msg);
}
}
LOG.error("Giving up after {} failed attempts to send notification to Atlas: {}", maxAttempts, message, notificationFailure);
LOG.error("Giving up after {} failed attempts to send notification to Atlas: {}", maxAttempts, messages.toString(), notificationFailure);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment