商品分类

异常打印
This commit is contained in:
2024-03-07 18:27:35 +08:00
parent ee8f860b13
commit ebbf0ba08d
2 changed files with 18 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import cn.ysk.cashier.utils.FastJsonUtils;
import cn.ysk.cashier.utils.SpringContextHolder;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
@@ -61,10 +62,17 @@ public class AppApiMethodAspect {
FastJsonUtils.toJSONString(result)
);
} catch (Throwable e) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e.getMessage());
if(StringUtils.isBlank(e.getMessage())){
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e);
}else{
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e.getMessage());
}
ResponseEntity<String> body = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
return body;
}