Commit e272a28e by Maxim Neaga Committed by Madhan Neethiraj

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

parent 243a4321
...@@ -173,7 +173,6 @@ public abstract class AtlasHook { ...@@ -173,7 +173,6 @@ public abstract class AtlasHook {
} }
final int maxAttempts = maxRetries < 1 ? 1 : maxRetries; final int maxAttempts = maxRetries < 1 ? 1 : maxRetries;
final String message = messages.toString();
Exception notificationFailure = null; Exception notificationFailure = null;
for (int numAttempt = 1; numAttempt <= maxAttempts; numAttempt++) { for (int numAttempt = 1; numAttempt <= maxAttempts; numAttempt++) {
...@@ -214,14 +213,16 @@ public abstract class AtlasHook { ...@@ -214,14 +213,16 @@ public abstract class AtlasHook {
} }
} }
if (notificationFailure != null) {
if (shouldLogFailedMessages && notificationFailure instanceof NotificationException) { if (shouldLogFailedMessages && notificationFailure instanceof NotificationException) {
final List<String> failedMessages = ((NotificationException) notificationFailure).getFailedMessages(); final List<String> failedMessages = ((NotificationException) notificationFailure).getFailedMessages();
for (String msg : failedMessages) { for (String msg : failedMessages) {
logger.log(msg); 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