package com.pgf.mqspring; import org.springframework.stereotype.Component; @Component public class MqMessageBuilder { private MqMessageBuilder() { } public static String getStackTrace(Exception e) { StackTraceElement[] list = e.getStackTrace(); StringBuilder b = new StringBuilder(); b.append(e.getMessage()); for( StackTraceElement s : list ) { b.append(s.toString()).append("\n"); } return b.toString(); } }