From 2653acd2b17677dd45142713f91a71a8909d977d Mon Sep 17 00:00:00 2001 From: Hai Yan <8153134+oeyh@users.noreply.github.com> Date: Mon, 13 May 2024 16:25:42 -0500 Subject: [PATCH] Fix an issue that exception messages are masked (#4416) * Show exception stacktrace Signed-off-by: Hai Yan * Tweak log messages Signed-off-by: Hai Yan --------- Signed-off-by: Hai Yan --- .../dataprepper/plugins/dlq/s3/S3DlqWriter.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/data-prepper-plugins/failures-common/src/main/java/org/opensearch/dataprepper/plugins/dlq/s3/S3DlqWriter.java b/data-prepper-plugins/failures-common/src/main/java/org/opensearch/dataprepper/plugins/dlq/s3/S3DlqWriter.java index 487e544e5c..c8ee665847 100644 --- a/data-prepper-plugins/failures-common/src/main/java/org/opensearch/dataprepper/plugins/dlq/s3/S3DlqWriter.java +++ b/data-prepper-plugins/failures-common/src/main/java/org/opensearch/dataprepper/plugins/dlq/s3/S3DlqWriter.java @@ -110,8 +110,8 @@ private void doWrite(final List dlqObjects, final String pipelineName final PutObjectResponse response = timedPutObject(putObjectRequest, content); if (!response.sdkHttpResponse().isSuccessful()) { - LOG.error(SENSITIVE, "Failed to write to S3 dlq: [{}] to S3 due to status code: [{}]", - content, response.sdkHttpResponse().statusCode()); + LOG.error(SENSITIVE, "Failed to write content [{}] to S3 dlq", content); + LOG.error("Failed to write to S3 dlq due to status code: [{}]", response.sdkHttpResponse().statusCode()); throw new IOException(String.format( "Failed to write to S3 dlq due to status code: %d", response.sdkHttpResponse().statusCode())); } @@ -123,8 +123,7 @@ private PutObjectResponse timedPutObject(final PutObjectRequest putObjectRequest } catch (final IOException ioException) { throw ioException; } catch (final Exception ex) { - LOG.error(SENSITIVE, "Failed timed write to S3 dlq: [{}] to S3 due to error: [{}]", - content, ex.getMessage()); + LOG.error(SENSITIVE, "Failed timed write to S3 dlq with content: [{}]", content, ex); throw new IOException("Failed timed write to S3 dlq.", ex); } } @@ -133,8 +132,7 @@ private PutObjectResponse putObject(final PutObjectRequest request, final String try { return s3Client.putObject(request, RequestBody.fromString(content)); } catch (Exception ex) { - LOG.error(SENSITIVE, "Failed to write to S3 dlq: [{}] to S3 due to error: [{}]", - content, ex.getMessage()); + LOG.error(SENSITIVE, "Failed to write content [{}] to S3 dlq", content, ex); throw new IOException("Failed to write to S3 dlq.", ex); } } @@ -149,8 +147,7 @@ private String deserialize(final List dlqObjects) throws IOException return content; } catch (JsonProcessingException e) { - LOG.error(SENSITIVE, "Failed to build valid S3 request body with dlqObjects: [{}] due to error: [{}]", - dlqObjects, e.getMessage()); + LOG.error(SENSITIVE, "Failed to build valid S3 request body with dlqObjects: [{}]", dlqObjects, e); throw new IOException("Failed to build valid S3 request body", e); } }