Commit 4f19b224 authored by Quxl's avatar Quxl

x

parent b61787a5
...@@ -30,16 +30,18 @@ public class LogServiceImpl implements LogService { ...@@ -30,16 +30,18 @@ public class LogServiceImpl implements LogService {
@Override @Override
public void saveErrorLog(Throwable ex) { public void saveErrorLog(Throwable ex) {
StringBuffer stack = new StringBuffer(); if(ex != null) {
stack.append(ex.getMessage()).append("\n"); StringBuffer stack = new StringBuffer();
StackTraceElement[] elms = ex.getStackTrace(); stack.append(ex.getMessage()).append("\n");
for(StackTraceElement elm : elms) { StackTraceElement[] elms = ex.getStackTrace();
stack.append(elm.getClassName() + "." + elm.getMethodName() + "(" + elm.getFileName() + " " + elm.getLineNumber() + ")").append("\n"); for(StackTraceElement elm : elms) {
stack.append(elm.getClassName()).append(".").append(elm.getMethodName()).append("(").append(elm.getFileName()).append(" ").append(elm.getLineNumber()).append(")\n");
}
Fc_logs_error error = new Fc_logs_error();
error.setError(stack.toString());
error.setCreate_time(new Date());
jdbcTemplate.save(error);
} }
Fc_logs_error error = new Fc_logs_error();
error.setError(stack.toString());
error.setCreate_time(new Date());
jdbcTemplate.save(error);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment