Commit 4f19b224 authored by Quxl's avatar Quxl

x

parent b61787a5
......@@ -30,16 +30,18 @@ public class LogServiceImpl implements LogService {
@Override
public void saveErrorLog(Throwable ex) {
StringBuffer stack = new StringBuffer();
stack.append(ex.getMessage()).append("\n");
StackTraceElement[] elms = ex.getStackTrace();
for(StackTraceElement elm : elms) {
stack.append(elm.getClassName() + "." + elm.getMethodName() + "(" + elm.getFileName() + " " + elm.getLineNumber() + ")").append("\n");
if(ex != null) {
StringBuffer stack = new StringBuffer();
stack.append(ex.getMessage()).append("\n");
StackTraceElement[] elms = ex.getStackTrace();
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