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) {
if(ex != null) {
StringBuffer stack = new StringBuffer(); StringBuffer stack = new StringBuffer();
stack.append(ex.getMessage()).append("\n"); stack.append(ex.getMessage()).append("\n");
StackTraceElement[] elms = ex.getStackTrace(); StackTraceElement[] elms = ex.getStackTrace();
for(StackTraceElement elm : elms) { for(StackTraceElement elm : elms) {
stack.append(elm.getClassName() + "." + elm.getMethodName() + "(" + elm.getFileName() + " " + elm.getLineNumber() + ")").append("\n"); 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(); Fc_logs_error error = new Fc_logs_error();
error.setError(stack.toString()); error.setError(stack.toString());
error.setCreate_time(new Date()); error.setCreate_time(new Date());
jdbcTemplate.save(error); 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