Former-commit-id: ac77254750b8778deab9b9d8b7dd2247c520f46a
master
wangbingit@outlook.com 5 years ago
parent 855f83b17a
commit 5dadea8173

@ -31,6 +31,7 @@ import ${domain}.frame.utils.LogUtil;
import ${domain}.frame.utils.MD5Util; import ${domain}.frame.utils.MD5Util;
import ${domain}.frame.utils.MapperUtil; import ${domain}.frame.utils.MapperUtil;
import ${domain}.frame.utils.StringUtil; import ${domain}.frame.utils.StringUtil;
import ${domain}.module.wsys.mgr.LogerrManager;
<#if project.frameValue() = 1> <#if project.frameValue() = 1>
import ${domain}.module.wsys.mgr.TokensManager; import ${domain}.module.wsys.mgr.TokensManager;
import ${domain}.module.wsys.req.TokensBuildRequest; import ${domain}.module.wsys.req.TokensBuildRequest;
@ -363,6 +364,12 @@ public class GlobalController {
e.printStackTrace(); e.printStackTrace();
response.addError(ErrorType.BUSINESS_ERROR, "方法执必须公开!"); response.addError(ErrorType.BUSINESS_ERROR, "方法执必须公开!");
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
try {
LogerrManager logerrManager = LocalData.getBean(LogerrManager.class);
logerrManager.addErr("系统错误", e.getTargetException().getMessage(), LogUtil.getTrace(e));
} catch (Exception ignored) {
}
LogUtil.dumpException(e.getTargetException()); LogUtil.dumpException(e.getTargetException());
e.getTargetException().printStackTrace(); e.getTargetException().printStackTrace();
response.addError(ErrorType.BUSINESS_ERROR, "方法执行错误[" + e.getTargetException().getMessage() + "]"); response.addError(ErrorType.BUSINESS_ERROR, "方法执行错误[" + e.getTargetException().getMessage() + "]");

@ -69,8 +69,9 @@ public class GlobalErrorController extends BasicErrorController {
modelAndView.setViewName("500"); modelAndView.setViewName("500");
} catch (Exception ignored) { } catch (Exception ignored) {
} } finally {
modelAndView.setViewName("500"); modelAndView.setViewName("500");
}
break; break;
} }

@ -51,6 +51,13 @@ public class LogUtil {
* *
*/ */
public static void dumpException(Throwable e){ public static void dumpException(Throwable e){
logger.error(getTrace(e));
}
/**
*
*/
public static String getTrace(Throwable e){
StringBuffer msg = new StringBuffer("null"); StringBuffer msg = new StringBuffer("null");
if (e != null) { if (e != null) {
msg = new StringBuffer(""); msg = new StringBuffer("");
@ -65,6 +72,6 @@ public class LogUtil {
msg.append(message); msg.append(message);
} }
} }
logger.error(msg.toString()); return msg.toString();
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.