@Around("execution(* com.iotx.cep.biz.rpc.impl.*.*(..)) "
+ "&& !execution(* com.iotx.cep.biz.rpc.impl.CepEngineServiceImpl.calcOffsetForSameSource(..))")
public Object addRpcLog(ProceedingJoinPoint jp) throws Throwable {
long startTime = System.currentTimeMillis();
String serviceName = extractServiceName(jp);
String method = jp.getSignature().getName();
String ip = LogUtil.getLocalIp();
String remoteIp = LogUtil.getRemoteIp();
IoTxResult result = null;
try {
result = (IoTxResult)jp.proceed();
} catch (IllegalArgumentException e) {
hsfLogger.warn("service={}; method={}", serviceName, method, e);
result = ResultCreator.paramError(e.getMessage());
} catch (Throwable t) {
hsfLogger.error("service={}; method={}", serviceName, method, t);
result = ResultCreator.serverError(t.getMessage());
} finally {
String params = JSON.toJSONString(jp.getArgs());
String resultStr = JSON.toJSONString(result);
long usedTime = System.currentTimeMillis() - startTime;
appendHsfLog(serviceName, method, usedTime, ip, remoteIp, result == null ? 0 : result.getCode(),
params, resultStr);
appendRpcProfilerLog(serviceName, method, result == null ? 0 : result.getCode(), usedTime);
}
return result;
}