public void logException(final String retCode, final String errMsg, final Exception e) { String className = ""; String methodName = ""; if (e.getStackTrace().length > 0) { className = e.getStackTrace()[0].getClassName(); methodName = e.getStackTrace()[0].getMethodName(); } StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw, true)); String exceptionMsg = sw.getBuffer().toString(); try { ExceptionLog exceptionLog = new ExceptionLog("", retCode, errMsg, exceptionMsg, className, methodName); exceptionLog.setAppName(this.projectName); exceptionLog.setLogType("exceptionlog"); this.logTokafka(exceptionLog); } catch (Exception var9) { this.logger.error(String.format("%s %s", "RBS0001", "logException"), var9); } }
日志记录异常类
最新推荐文章于 2023-06-03 22:44:15 发布