/// <summary> /// 方法异常处理 /// </summary> /// <param name="requestMsg"></param> /// <param name="ex"></param> public override void OnException(System.Runtime.Remoting.Messaging.IMessage requestMsg, Exception ex) { var msg = requestMsg as System.Runtime.Remoting.Messaging.IMethodCallMessage; #region 异常 AopLogAttribute logAttr = null; var attrs = msg.MethodBase.GetCustomAttributes(typeof(AopLogAttribute), false); if (attrs.Length > 0) { logAttr = attrs[0] as AopLogAttribute; } using (var business = new BusinessLog()) { business.LogException(msg, logAttr, ex); } #endregion }
/// <summary> /// 方法执行前处理 /// </summary> /// <param name="requestMsg"></param> public override void Invoking(System.Runtime.Remoting.Messaging.IMessage requestMsg) { var msg = requestMsg as System.Runtime.Remoting.Messaging.IMethodCallMessage; #region log AopLogAttribute logAttr = null; var attrs = msg.MethodBase.GetCustomAttributes(typeof(AopLogAttribute), false); if (attrs.Length > 0) { logAttr = attrs[0] as AopLogAttribute; } if (logAttr != null) { using (var business = new BusinessLog()) { business.LogBusiness(msg, logAttr); } } #endregion }
/// <summary> /// 业务日志记录 /// </summary> /// <param name="msg"></param> /// <param name="logAttr"></param> public void LogBusiness(System.Runtime.Remoting.Messaging.IMessage msg, AopLogAttribute logAttr) { //TODO 业务日志记录 }
/// <summary> /// 异常记录 /// </summary> /// <param name="msg"></param> /// <param name="logAttr"></param> /// <param name="ex"></param> public void LogException(System.Runtime.Remoting.Messaging.IMessage msg, AopLogAttribute logAttr, Exception ex) { //TODO 异常记录 }