Skip to content

Commit a3dd2f3

Browse files
Log attachment generation failures (elastic#50080)
Watcher logs when actions fail in ActionWrapper, but failures to generate an email attachment are not logged and we thus only know the type of the exception and not where/how it occurred.
1 parent 926d142 commit a3dd2f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/email/ExecutableEmailAction.java

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
package org.elasticsearch.xpack.watcher.actions.email;
77

88
import org.apache.logging.log4j.Logger;
9+
import org.apache.logging.log4j.message.ParameterizedMessage;
10+
import org.apache.logging.log4j.util.Supplier;
911
import org.elasticsearch.ElasticsearchException;
1012
import org.elasticsearch.xpack.core.watcher.actions.Action;
1113
import org.elasticsearch.xpack.core.watcher.actions.ExecutableAction;
@@ -57,6 +59,8 @@ public Action.Result execute(String actionId, WatchExecutionContext ctx, Payload
5759
Attachment attachment = parser.toAttachment(ctx, payload, emailAttachment);
5860
attachments.put(attachment.id(), attachment);
5961
} catch (ElasticsearchException | IOException e) {
62+
logger().error(
63+
(Supplier<?>) () -> new ParameterizedMessage("failed to execute action [{}/{}]", ctx.watch().id(), actionId), e);
6064
return new EmailAction.Result.FailureWithException(action.type(), e);
6165
}
6266
}

0 commit comments

Comments
 (0)