add:异常堆栈换行
This commit is contained in:
@@ -117,19 +117,20 @@ public class LogAspect {
|
|||||||
}
|
}
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
StringBuffer errorStack = new StringBuffer();
|
StringBuffer errorStack = new StringBuffer();
|
||||||
|
errorStack.append("<br/>【异常堆栈:");
|
||||||
String errorMsg = ex.getMessage();
|
String errorMsg = ex.getMessage();
|
||||||
int x = 0;
|
int x = 0;
|
||||||
StackTraceElement[] stackTrace = ex.getStackTrace();
|
StackTraceElement[] stackTrace = ex.getStackTrace();
|
||||||
if (stackTrace!=null && stackTrace.length>0){
|
if (stackTrace!=null && stackTrace.length>0){
|
||||||
for (StackTraceElement stack : stackTrace) {
|
for (StackTraceElement stack : stackTrace) {
|
||||||
x++;
|
x++;
|
||||||
errorStack.append(stack.toString()).append(" | ");
|
errorStack.append(stack.toString().replaceAll("<",">")).append("<br/>");
|
||||||
if (x>10){
|
if (x>10){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.error("[-requestError-][请求接口:{}]【异常信息:{}】[请求参数:{}][异常堆栈:{}]", url,errorMsg,params, errorStack.toString());
|
log.error("[-requestError-][请求接口:{}]【异常信息:{}】[请求参数:{}] {}", url,errorMsg,params, errorStack.append("】").toString());
|
||||||
Log log = new Log("ERROR", System.currentTimeMillis() - comming);
|
Log log = new Log("ERROR", System.currentTimeMillis() - comming);
|
||||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(ex).getBytes());
|
log.setExceptionDetail(ThrowableUtil.getStackTrace(ex).getBytes());
|
||||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
|
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
|
||||||
|
|||||||
Reference in New Issue
Block a user