Java Exception转String

public static String getLogInfo(Exception e){
    StringWriter sw = new StringWriter(); 
    e.printStackTrace(new PrintWriter(sw, true)); 
    return sw.toString();
}

你可能感兴趣的:(JAVA)