| | |
| | | @Value("${spring.profiles.active}") |
| | | private String profiles; |
| | | |
| | | @Value("${app.project}") |
| | | private String projectName; |
| | | |
| | | @Pointcut("execution(* com.xcong.excoin..*.*(..))") |
| | | public void exceptionCatch() { |
| | | } |
| | |
| | | throw ex; |
| | | } |
| | | |
| | | if (profiles.equals("dev") || profiles.equals("test")) { |
| | | throw ex; |
| | | } |
| | | |
| | | SysExceptionDetailEntity exceptionData = new SysExceptionDetailEntity(); |
| | | String exStr = printStackTraceToString(ex); |
| | | ThreadPoolUtils.EXECUTOR.execute(new Runnable(){ |
| | |
| | | try { |
| | | log.info("插入"); |
| | | exceptionData.setCreateTime(new Date()); |
| | | exceptionData.setMachine(InetAddress.getLocalHost().getHostName() + "-" + profiles); |
| | | exceptionData.setMachine(projectName + "-" + InetAddress.getLocalHost().getHostName() + "-" + profiles); |
| | | exceptionData.setAddress(InetAddress.getLocalHost().getHostAddress()); |
| | | exceptionData.setExceptionMsg(exStr); |
| | | exceptionData.setSimpleMsg(ex.getMessage()); |
| | | sysExceptionDetailDao.insert(exceptionData); |
| | | |
| | | DingTalkUtils.sendMsg(profiles + "--" + ex.getMessage(), exStr.substring(0, 200), exceptionData.getId()); |
| | | String msg = ""; |
| | | if (exStr.length() > 200) { |
| | | msg = exStr.substring(0, 200); |
| | | } else { |
| | | msg = exStr; |
| | | } |
| | | DingTalkUtils.sendMsg(projectName + "-" +profiles + "--" + ex.getMessage(), msg, exceptionData.getId()); |
| | | } catch (Exception e) { |
| | | log.error("exception aop", e); |
| | | } |