Commit df54851c by huluobin

异常日志修改

parent ccf0d23a
......@@ -2,9 +2,7 @@ package com.gogirl.infrastructure.common.exception;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.exception.RRException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -34,14 +32,14 @@ public class RRExceptionHandler {
result.setCode(e.getCode());
result.setMessage(e.getMessage());
if (e.getCode() != 2000 && e.getCode() != 1001 && e.getCode() != 2005 && e.getCode() != 2006) {
log.error("Params : {}", getParamString(request.getParameterMap()) + "\n");
log.error("URI : {}", request.getRequestURI() + "\n");
if (e.getCode() ==500 && e.getMessage().equals("业务异常")) {
//
// log.error("Params : {}", getParamString(request.getParameterMap()) + "\n");
// log.error("URI : {}", request.getRequestURI() + "\n");
log.error(e.getMessage(), e);
} else {
log.error("Params : {}", getParamString(request.getParameterMap()) + "\n");
log.error("URI : {}", request.getRequestURI() + "\n");
// log.error("Params : {}", getParamString(request.getParameterMap()) + "\n");
// log.error("URI : {}", request.getRequestURI() + "\n");
log.error(e.getMessage());
}
return result;
......@@ -63,20 +61,6 @@ public class RRExceptionHandler {
return result;
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public JsonResult<String> MethodArgumentNotValidException(HttpServletRequest request,
MethodArgumentNotValidException ex) {
JsonResult<String> result = new JsonResult<>();
result.setSuccess(false);
result.setCode(500);
result.setMessage("参数错误。");
log.error("Params : {}", getParamString(request.getParameterMap()) + "\n");
log.error("URI : {}", request.getRequestURI() + "\n");
log.error(ex.getMessage(), ex);
return result;
}
private String getParamString(Map<String, String[]> map) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String[]> e : map.entrySet()) {
......
package com.gogirl.infrastructure.interceptor;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.util.JsonUtilByFsJson;
import com.gogirl.infrastructure.common.util.JsonUtilByJackson;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
......@@ -74,7 +76,9 @@ public class LogAspect {
HttpServletRequest request = attributes.getRequest();
// 会打印出一个对象,想打印出具体内容需要在定义模型处加上toString()
//logger.info( "result:{}", object.toString() );
// logger.info("result:{}", JsonUtilByFsJson.beanToJson(object));
JsonResult jsonResult = JsonUtilByJackson.readValue(JsonUtilByJackson.writeValueAsString(object), JsonResult.class);
jsonResult.setData("hidden data");
logger.info("result:{}", JsonUtilByJackson.writeValueAsString(jsonResult));
;
}
......
......@@ -57,7 +57,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
......@@ -107,8 +106,11 @@ public class Schedule {
private final CareerMapper careerMapper;
private final StoreManageMapper storeManageMapper;
private final StoreDataMapper storeDataMapper;
private final RestTemplate restTemplate;
/**
* 每天定时任务,判断优惠券是否过期
*/
......@@ -337,8 +339,6 @@ public class Schedule {
log.debug("同步闲时折扣周 结束");
}
@Resource
RestTemplate restTemplate;
/**
* 定时同步美甲师成长历程
......
......@@ -83,6 +83,7 @@ gogirl:
test-paper-time: 1
#后台后端接口访问地址
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
wx:
pay:
appId: wx058b46db3cd0e979
......
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