public static void writeException(Exception e) {
if (e == null) {
log.error("unknown error");
return;
}
try {
StackTraceElement[] s = e.getStackTrace();
StringBuffer em = new StringBuffer(e.getMessage());
if (s != null) {
for (int i = 0; i < s.length; i++) {
StackTraceElement st = s[i];
em.append("\t\t").append(st.toString()).append("\r\n");
}
}
log.error(em.toString());
} catch (Exception e1) {
e1.printStackTrace();
}
}