日志规范
2020-09-17 18:27:21 782
日志中要打印参数
错误示例
@GetMapping("/share_coupon")
public ActionResult shareCoupon(Long couponSn) {
//validate code
try {
return couponService.shareCoupon(couponSn);
} catch (Exception e) {
log.error("分享卡券领取失败");
return ActionResult.error("分享卡券领取失败");
}
}
较为正确的示例
@GetMapping("/share_coupon")
public ActionResult shareCoupon(Long couponSn) {
//validate code
try {
return couponService.shareCoupon(couponSn);
} catch (Exception e) {
log.error("分享卡券领取失败,couponSn:{}", couponSn, e);
return ActionResult.error("分享卡券领取失败");
}
}