Created
February 8, 2016 14:01
-
-
Save baxtheman/25d7d79a9f8c46e218b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void notifyError(final Throwable e) { | |
try { | |
if (Validator.isNull(PortletPropsValues.WEBHOOK_LOG_URL)) { | |
return; | |
} | |
final StringBuilder sb = new StringBuilder(); | |
sb.append("machine: " + PortalUtil.getComputerName()); | |
sb.append("\n"); | |
for (StackTraceElement element : e.getStackTrace()) { | |
sb.append(element.toString()); | |
sb.append("\n"); | |
} | |
HttpResponse<String> jsonResponse = | |
Unirest.post(PortletPropsValues.WEBHOOK_LOG_URL) | |
.field("payload",new JSONObject(){{ | |
put("pretext", e.getMessage()); | |
put("text", sb.toString()); | |
put("color", "#D00000"); | |
}}) | |
.asString(); | |
} | |
catch (Exception e1) { | |
_log.error(e1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment