From b8c7ebf6425937c0686ed6389824c649bbd1349f Mon Sep 17 00:00:00 2001 From: hxw2303632 Date: Thu, 18 Apr 2019 13:51:02 +0800 Subject: [PATCH] add log code --- src/main/java/com/qiwu/chatbotbackend/servlet/GetAnswerServlet.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/qiwu/chatbotbackend/servlet/GetAnswerServlet.java b/src/main/java/com/qiwu/chatbotbackend/servlet/GetAnswerServlet.java index c55c61e..5d60f05 100644 --- a/src/main/java/com/qiwu/chatbotbackend/servlet/GetAnswerServlet.java +++ b/src/main/java/com/qiwu/chatbotbackend/servlet/GetAnswerServlet.java @@ -72,6 +72,7 @@ public class GetAnswerServlet extends HttpServlet { UserInfo userinfo = null; UserInfoController uiController = new UserInfoController(); + logWriter.record("query bot config", 0); userinfo = uiController.userInfoQuery(request.getParameter("bot_name"), context); @@ -84,9 +85,14 @@ public class GetAnswerServlet extends HttpServlet { if (userinfo.varInitialMap.get("botType") != null) botType = userinfo.varInitialMap.get("botType"); + logWriter.record("get chat cache start", 0); chatCache = ChatCacheController.getChatCache(userKey, randKey, context, userinfo, botType); + + logWriter.record("get chat cache complete", 0); + + if (chatCache == null) { throw (new Exception("chatCache初始化失败")); } @@ -110,14 +116,19 @@ public class GetAnswerServlet extends HttpServlet { break; } + logWriter.record("form preprocessing", 0); + //针对不同游戏类型对信息点做预处理 debugFlag = botUtil.preprocessing(receiveParamters, context); + logWriter.record("action match start", 0); //信息点预处理 ActionMatcher matcher = new ActionMatcher(curInfoPoint, logWriter, userinfo, context, botUtil); + logWriter.record("action match complete", 0); + /*得到答案更新信息点&生成答案,,清除超时会话数据, 转成json,输出*/ ansAction = matcher.getBestMatch(userinfo.conditionTable, context, userinfo); if (state.equals("") && ansAction.getPriority() == -1) @@ -157,6 +168,7 @@ public class GetAnswerServlet extends HttpServlet { matcher.infoTransfer(bestMatch, context, debugFlag); + logWriter.record("update chat cache start", 0); ChatCacheController.updateChatCache4Insert(curInfoPoint, chatCache, context, userinfo); //清理超时的用户数据 @@ -167,6 +179,8 @@ public class GetAnswerServlet extends HttpServlet { context.setAttribute("cacheUpdateTime", System.currentTimeMillis()); } + logWriter.record("update chat cache complete", 0); + ansJ = SimpleUtil.toJson(bestMatch); } else { -- libgit2 0.27.1