package com.saye.hospitalgd.commons.log;

public class ExceptionDUtil {

	/**
	 * 返回异常的详细信息
	 * @param e
	 * @return
	 */
	public static String getDetailExceptionMsg(Exception e){
		
		StringBuffer exceptionMessage = new StringBuffer();
		
		StackTraceElement[] stackTraceElementes = e.getStackTrace();
		int length = stackTraceElementes.length;
		StackTraceElement ste;
		//只要最顶上的错误栈
		for(int i=0;i<length;i++){
			ste = stackTraceElementes[i];
			exceptionMessage.append(ste.getClassName()+":"+ste.getLineNumber()+"行\r\n");
			//break;
		}
		
		String result = e.toString()+"\r\n"+exceptionMessage.toString();
		return result;
	}
}
