List of usage examples for org.apache.commons.lang3.exception ExceptionUtils printRootCauseStackTrace
public static void printRootCauseStackTrace(final Throwable throwable, final PrintWriter writer)
Prints a compact stack trace for the root cause of a throwable.
The compact stack trace starts with the root cause and prints stack frames up to the place where it was caught and wrapped.
From source file:com.granita.contacticloudsync.log.CustomLogger.java
protected void log(String prefix, String msg, Throwable t) { writer.write(prefix + msg + " - EXCEPTION:\n"); t.printStackTrace(writer);//from ww w. ja v a 2 s. com ExceptionUtils.printRootCauseStackTrace(t, writer); }
From source file:$.DirectCallController.java
@RequestMapping(value = "/directCall", method = RequestMethod.POST) public String processCallForm(@ModelAttribute("model") ModelMap modelMap, @RequestParam("body") String body, @RequestParam("uri") String uri, @RequestParam("senderRef") String senderRef, @RequestParam("soapAction") @Nullable String soapAction, @RequestParam("header") String header) { Assert.hasText(body, "the body must not be empty"); Assert.hasText(uri, "the uri must not be empty"); Assert.hasText(senderRef, "the senderRef must not be empty"); // generate unique ID String callId = UUID.randomUUID().toString(); // save params into registry DirectCallParams params = new DirectCallParams(body, uri, senderRef, soapAction, StringUtils.trimToNull(header)); callRegistry.addParams(callId, params); // call external system via internal servlet route try {//from ww w.ja va 2 s .co m Log.debug("Calling external system with callId=" + callId + ", params: " + params); String res = directCall.makeCall(callId); modelMap.put(CALL_RESULT_ATTR, MessageController.prettyPrintXML(res)); } catch (Exception ex) { // error occurred StringWriter strOut = new StringWriter(); PrintWriter resStr = new PrintWriter(strOut); ExceptionUtils.printRootCauseStackTrace(ex, resStr); modelMap.put(CALL_RESULT_ERR_ATTR, strOut.toString()); } modelMap.put("header", header); modelMap.put("body", body); modelMap.put("uri", uri); modelMap.put("senderRef", senderRef); modelMap.put("soapAction", soapAction); return VIEW_NAME; }
From source file:org.cleverbus.admin.web.msg.DirectCallController.java
@RequestMapping(value = "/directCall", method = RequestMethod.POST) public String processCallForm(@ModelAttribute("model") ModelMap modelMap, @RequestParam("body") String body, @RequestParam("uri") String uri, @RequestParam("senderRef") String senderRef, @RequestParam("soapAction") @Nullable String soapAction, @RequestParam("header") String header) { Assert.hasText(body, "the body must not be empty"); Assert.hasText(uri, "the uri must not be empty"); Assert.hasText(senderRef, "the senderRef must not be empty"); // generate unique ID String callId = UUID.randomUUID().toString(); // save params into registry DirectCallParams params = new DirectCallParams(body, uri, senderRef, soapAction, StringUtils.trimToNull(header)); callRegistry.addParams(callId, params); // call external system via internal servlet route try {// w w w. ja va2s. co m Log.debug("Calling external system with callId=" + callId + ", params: " + params); String res = directCall.makeCall(callId); modelMap.put(CALL_RESULT_ATTR, MessageController.prettyPrintXML(res)); } catch (Exception ex) { // error occurred StringWriter strOut = new StringWriter(); PrintWriter resStr = new PrintWriter(strOut); ExceptionUtils.printRootCauseStackTrace(ex, resStr); modelMap.put(CALL_RESULT_ERR_ATTR, strOut.toString()); } modelMap.put("header", header); modelMap.put("body", body); modelMap.put("uri", uri); modelMap.put("senderRef", senderRef); modelMap.put("soapAction", soapAction); return VIEW_NAME; }