|
|
@@ -18,6 +18,7 @@ import ss.db.Db;
|
|
|
import ss.db.FaceCollectDb;
|
|
|
import ss.db.SqlCmd;
|
|
|
import ss.http.HttpU;
|
|
|
+import ss.log.SsLog;
|
|
|
import ss.serv.Serv;
|
|
|
import ss.serv.ServC;
|
|
|
|
|
|
@@ -82,7 +83,9 @@ public class FaceCollectServ extends Serv {
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
public String uploadTrace() {
|
|
|
- super.wrJsonByResp(uploadTraceResult());
|
|
|
+ Map<String, Object> result = uploadTraceResult();
|
|
|
+ SsLog.log("FaceCollectServ.uploadTrace() 返回:" + buildTraceUploadResultLog(result));
|
|
|
+ super.wrJsonByResp(result);
|
|
|
return ServC.SERV_notByA;
|
|
|
}
|
|
|
|
|
|
@@ -429,6 +432,8 @@ public class FaceCollectServ extends Serv {
|
|
|
String clientIp = rdClientIp(super.req);
|
|
|
String contentType = rdReqContentType();
|
|
|
String paramKeys = rdReqParamKeys();
|
|
|
+ SsLog.log("FaceCollectServ.uploadTraceResult() 入口:" +
|
|
|
+ buildTraceUploadAuditLog("entry", token, scene, batchId, clientIp, contentType, paramKeys, summary, null, null, null));
|
|
|
|
|
|
if (StringUtils.isBlank(token))
|
|
|
return mkTraceUploadFail("FACE_COLLECT_PARAM_INVALID", "缺少二维码令牌。",
|
|
|
@@ -447,6 +452,9 @@ public class FaceCollectServ extends Serv {
|
|
|
|
|
|
log4j.warn("FaceCollectServ.uploadTraceResult() token={}, scene={}, batchId={}, clientIp={}, contentType={}, paramKeys={}, summary={}, trace={}",
|
|
|
maskToken(token), scene, batchId, clientIp, contentType, paramKeys, summary, traceCompact);
|
|
|
+ SsLog.log("FaceCollectServ.uploadTraceResult() 成功:" +
|
|
|
+ buildTraceUploadAuditLog("success", token, scene, batchId, clientIp, contentType, paramKeys,
|
|
|
+ summary, traceCompact, "0", "调试日志上报成功"));
|
|
|
|
|
|
logOper(gdba, 0L, "", token, "uploadTrace", true, StringUtils.left(summary, 1000));
|
|
|
gdba.commit();
|
|
|
@@ -479,6 +487,9 @@ public class FaceCollectServ extends Serv {
|
|
|
String token, String scene, String batchId,
|
|
|
String clientIp, String contentType, String paramKeys,
|
|
|
String summary, Exception e) {
|
|
|
+ SsLog.log("FaceCollectServ.uploadTraceResult() 失败:" +
|
|
|
+ buildTraceUploadAuditLog(failReason, token, scene, batchId, clientIp, contentType, paramKeys,
|
|
|
+ summary, null, code, msg + (e == null ? "" : ("; err=" + e.getMessage()))));
|
|
|
if (e == null) {
|
|
|
log4j.warn("FaceCollectServ.uploadTraceResult() 业务失败: reason={}, token={}, scene={}, batchId={}, clientIp={}, contentType={}, paramKeys={}, summary={}",
|
|
|
failReason, maskToken(token), scene, batchId, clientIp, contentType, paramKeys, summary);
|
|
|
@@ -489,6 +500,41 @@ public class FaceCollectServ extends Serv {
|
|
|
return mkFail(code, msg);
|
|
|
}
|
|
|
|
|
|
+ private String buildTraceUploadAuditLog(String stage, String token, String scene, String batchId,
|
|
|
+ String clientIp, String contentType, String paramKeys,
|
|
|
+ String summary, String traceCompact, String code, String msg) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("stage=").append(StringUtils.defaultIfBlank(stage, "-"));
|
|
|
+ sb.append(",token=").append(maskToken(token));
|
|
|
+ sb.append(",scene=").append(StringUtils.defaultIfBlank(scene, "-"));
|
|
|
+ sb.append(",batchId=").append(StringUtils.defaultIfBlank(batchId, "-"));
|
|
|
+ sb.append(",clientIp=").append(StringUtils.defaultIfBlank(clientIp, "-"));
|
|
|
+ sb.append(",contentType=").append(StringUtils.defaultIfBlank(contentType, "-"));
|
|
|
+ sb.append(",paramKeys=").append(StringUtils.defaultIfBlank(paramKeys, "-"));
|
|
|
+ sb.append(",summary=").append(StringUtils.defaultIfBlank(summary, "-"));
|
|
|
+ if (StringUtils.isNotBlank(code))
|
|
|
+ sb.append(",code=").append(code);
|
|
|
+ if (StringUtils.isNotBlank(msg))
|
|
|
+ sb.append(",msg=").append(StringUtils.left(msg, 500));
|
|
|
+ if (StringUtils.isNotBlank(traceCompact))
|
|
|
+ sb.append(",trace=").append(StringUtils.left(traceCompact, 1000));
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ private String buildTraceUploadResultLog(Map<String, Object> result) {
|
|
|
+ if (result == null)
|
|
|
+ return "result=null";
|
|
|
+ Map<String, Object> data = castData(result);
|
|
|
+ return "ok=" + rdBool(result.get("ok"))
|
|
|
+ + ",code=" + rdStr(result.get("code"))
|
|
|
+ + ",msg=" + rdStr(result.get("msg"))
|
|
|
+ + ",scene=" + rdStr(data.get("scene"))
|
|
|
+ + ",batchId=" + rdStr(data.get("batchId"))
|
|
|
+ + ",uploadReason=" + rdStr(data.get("uploadReason"))
|
|
|
+ + ",latestEvent=" + rdStr(data.get("latestEvent"))
|
|
|
+ + ",traceSize=" + rdStr(data.get("traceSize"));
|
|
|
+ }
|
|
|
+
|
|
|
private TokenChkResult chkToken(Db gdba, String token, String reqScene, String reqBatchId,
|
|
|
boolean needQuota, boolean forUpdate) throws SQLException {
|
|
|
if (StringUtils.isBlank(token))
|