Skip to content

Commit

Permalink
log message change for debugging (#321) (#322)
Browse files Browse the repository at this point in the history
Signed-off-by: Subhobrata Dey <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] authored Feb 9, 2023
1 parent 120bf78 commit 1db129f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public RestStatus status() {
}

public static OpenSearchException wrap(Exception ex) {
log.error(String.format(Locale.getDefault(), "Security Analytics error: %s", ex.getMessage()));
log.error("Security Analytics error:", ex);

String friendlyMsg = "Unknown error";
RestStatus status = RestStatus.INTERNAL_SERVER_ERROR;
Expand All @@ -52,7 +52,7 @@ public static OpenSearchException wrap(Exception ex) {
}

public static OpenSearchException wrap(OpenSearchException ex) {
log.error(String.format(Locale.getDefault(), "Security Analytics error: %s", ex.getMessage()));
log.error("Security Analytics error:", ex);

String friendlyMsg = "Unknown error";
RestStatus status = ex.status();
Expand All @@ -71,10 +71,10 @@ public static OpenSearchException wrap(List<Exception> ex) {
XContentBuilder builder = XContentFactory.jsonBuilder().startObject();
for (Exception e: ex) {
builder.field("error", e.getMessage());
log.error("Security Analytics error:", e);
}
builder.endObject();
String friendlyMsg = Strings.toString(builder);
log.error(String.format(Locale.getDefault(), "Security Analytics error: %s", friendlyMsg));

return new SecurityAnalyticsException(friendlyMsg, status, new Exception(String.format(Locale.getDefault(), "%s: %s", ex.getClass().getName(), friendlyMsg)));
} catch (IOException e) {
Expand Down

0 comments on commit 1db129f

Please sign in to comment.