添加一个日志记录异常参数打印

This commit is contained in:
yangsb
2024-04-03 10:10:56 +08:00
parent be2ffc7377
commit 0ff00b0801
@@ -8,6 +8,7 @@ import com.cf.imes.module.infra.dal.dataobject.logger.ApiErrorLogDO;
import com.cf.imes.module.infra.dal.mysql.logger.ApiErrorLogMapper;
import com.cf.imes.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -35,7 +36,11 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
try {
apiErrorLogMapper.insert(apiErrorLog);
}catch (DataIntegrityViolationException e) {
log.error(apiErrorLog.toString());
}
}
@Override