如何将异常堆栈跟踪打印到网页?
import com.opensymphony.xwork2.ActionSupport;
import java.util.Arrays;
public class ExceptionAction extends ActionSupport
{
public String execute()
{
//
String errMsg = Arrays.toString(Thread.currentThread().getStackTrace());
this.addActionError(
"Unexcepted error has occurred. \n"
+errMsg
+ "\nPlease try again or report this error to administrator or support team. \n ");
return "error";
}
/**
*
*/
private static final long serialVersionUID = -3754090784536811052L;
}
但我得到了一个无用的味精使用上面的代码,味精是这样的:
[java.lang.Thread.getStackTrace(Thread.java:1479), com.monitoring.action.ExceptionAction.execute(ExceptionAction.java:11), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39),