diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java index 9049312a931..35a3e90e60b 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java @@ -248,7 +248,7 @@ public String doGetConfig(HttpServletRequest request, HttpServletResponse respon Channels.newChannel(response.getOutputStream())); } - LogUtil.pullCheckLog.warn("{}|{}|{}|{}", new Object[]{groupKey,requestIp,md5, TimeUtils.getCurrentTimeStr()}); + LogUtil.pullCheckLog.warn("{}|{}|{}|{}", groupKey,requestIp,md5, TimeUtils.getCurrentTimeStr()); final long delayed = System.currentTimeMillis() - lastModified; @@ -275,7 +275,7 @@ public String doGetConfig(HttpServletRequest request, HttpServletResponse respon } else { - pullLog.info("[client-get] clientIp={}, {}, get data during dump", new Object[]{clientIp, groupKey}); + pullLog.info("[client-get] clientIp={}, {}, get data during dump", clientIp, groupKey); response.setStatus(HttpServletResponse.SC_CONFLICT); response.getWriter().println("requested file is being modified, please try later."); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/monitor/MemoryMonitor.java b/config/src/main/java/com/alibaba/nacos/config/server/monitor/MemoryMonitor.java index b059bf27392..d9e5bf9c7f8 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/monitor/MemoryMonitor.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/monitor/MemoryMonitor.java @@ -63,8 +63,7 @@ public void run() { int groupCount = ConfigService.groupCount(); int subClientCount = ClientTrackService.subscribeClientCount(); long subCount = ClientTrackService.subscriberCount(); - memoryLog.info("groupCount={}, subscriberClientCount={}, subscriberCount={}", - new Object[] { groupCount, subClientCount, subCount }); + memoryLog.info("groupCount={}, subscriberClientCount={}, subscriberCount={}", groupCount, subClientCount, subCount); } } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigService.java index d1e01a8ee64..0460660b214 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigService.java @@ -79,8 +79,9 @@ static public boolean dump(String dataId, String group, String tenant, String co final String md5 = MD5.getInstance().getMD5String(content); if (md5.equals(ConfigService.getContentMd5(groupKey))) { dumpLog.warn( - "[dump-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, lastModifiedNew={}", - new Object[] { groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs }); + "[dump-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, " + + "lastModifiedNew={}", + groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs); } else if (!PropertyUtil.isStandaloneMode()) { DiskUtil.saveToDisk(dataId, group, tenant, content); } @@ -121,7 +122,10 @@ static public boolean dumpBeta(String dataId, String group, String tenant, Strin try { final String md5 = MD5.getInstance().getMD5String(content); if(md5.equals(ConfigService.getContentBetaMd5(groupKey))) { - dumpLog.warn("[dump-beta-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, lastModifiedNew={}", new Object[]{groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs}); + dumpLog.warn( + "[dump-beta-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, " + + "lastModifiedNew={}", + groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs); } else if (!PropertyUtil.isStandaloneMode()) { DiskUtil.saveBetaToDisk(dataId, group, tenant, content); } @@ -156,7 +160,10 @@ static public boolean dumpTag(String dataId, String group, String tenant, String try { final String md5 = MD5.getInstance().getMD5String(content); if(md5.equals(ConfigService.getContentTagMd5(groupKey,tag))) { - dumpLog.warn("[dump-tag-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, lastModifiedNew={}", new Object[]{groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs}); + dumpLog.warn( + "[dump-tag-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, " + + "lastModifiedNew={}", + groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs); } else if (!PropertyUtil.isStandaloneMode()) { DiskUtil.saveTagToDisk(dataId, group, tenant, tag, content); } @@ -192,7 +199,10 @@ static public boolean dumpChange(String dataId, String group, String tenant, Str if (!PropertyUtil.isStandaloneMode()) { String loacalMd5 = DiskUtil.getLocalConfigMd5(dataId, group, tenant); if(md5.equals(loacalMd5)) { - dumpLog.warn("[dump-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, lastModifiedNew={}", new Object[]{groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs}); + dumpLog.warn( + "[dump-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, " + + "lastModifiedNew={}", + groupKey, md5, ConfigService.getLastModifiedTs(groupKey), lastModifiedTs); } else { DiskUtil.saveToDisk(dataId, group, tenant, content); } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/LongPullingService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/LongPullingService.java index beed7b2368e..1609dce8e12 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/LongPullingService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/LongPullingService.java @@ -240,13 +240,13 @@ public void addLongPullingClient(HttpServletRequest req, HttpServletResponse rsp if (changedGroups.size() > 0) { generateResponse(req, rsp, changedGroups); LogUtil.clientLog.info("{}|{}|{}|{}|{}|{}|{}", - new Object[]{System.currentTimeMillis() - start, "instant", RequestUtil.getRemoteIp(req), "polling", - clientMd5Map.size(), probeRequestSize, changedGroups.size()}); + System.currentTimeMillis() - start, "instant", RequestUtil.getRemoteIp(req), "polling", + clientMd5Map.size(), probeRequestSize, changedGroups.size()); return; } else if(noHangUpFlag!=null && noHangUpFlag.equalsIgnoreCase(TRUE_STR)) { - LogUtil.clientLog.info("{}|{}|{}|{}|{}|{}|{}", - new Object[]{System.currentTimeMillis() - start, "nohangup", RequestUtil.getRemoteIp(req), "polling", - clientMd5Map.size(), probeRequestSize, changedGroups.size()}); + LogUtil.clientLog.info("{}|{}|{}|{}|{}|{}|{}", System.currentTimeMillis() - start, "nohangup", + RequestUtil.getRemoteIp(req), "polling", clientMd5Map.size(), probeRequestSize, + changedGroups.size()); return; } } @@ -335,9 +335,10 @@ public void run() { getRetainIps().put(clientSub.ip, System.currentTimeMillis()); iter.remove(); // 删除订阅关系 LogUtil.clientLog.info("{}|{}|{}|{}|{}|{}|{}", - new Object[]{(System.currentTimeMillis() - changeTime), - "in-advance", RequestUtil.getRemoteIp((HttpServletRequest) clientSub.asyncContext.getRequest()), "polling", - clientSub.clientMd5Map.size(), clientSub.probeRequestSize, groupKey}); + (System.currentTimeMillis() - changeTime), + "in-advance", RequestUtil.getRemoteIp((HttpServletRequest) clientSub.asyncContext.getRequest()), + "polling", + clientSub.clientMd5Map.size(), clientSub.probeRequestSize, groupKey); clientSub.sendResponse(Arrays.asList(groupKey)); } } @@ -394,9 +395,10 @@ public void run() { if(isFixedPolling()) { LogUtil.clientLog.info("{}|{}|{}|{}|{}|{}", - new Object[]{(System.currentTimeMillis() - createTime), - "fix", RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), "polling", - clientMd5Map.size(), probeRequestSize}); + (System.currentTimeMillis() - createTime), + "fix", RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), + "polling", + clientMd5Map.size(), probeRequestSize); List changedGroups = MD5Util.compareMd5((HttpServletRequest) asyncContext.getRequest(), (HttpServletResponse) asyncContext.getResponse(), clientMd5Map); if (changedGroups.size() > 0) { sendResponse(changedGroups); @@ -405,9 +407,10 @@ public void run() { } } else { LogUtil.clientLog.info("{}|{}|{}|{}|{}|{}", - new Object[]{(System.currentTimeMillis() - createTime), - "timeout", RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), "polling", - clientMd5Map.size(), probeRequestSize}); + (System.currentTimeMillis() - createTime), + "timeout", RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), + "polling", + clientMd5Map.size(), probeRequestSize); sendResponse(null); } } catch (Throwable t) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java index 0e90710201d..a0303c4281d 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java @@ -52,7 +52,7 @@ public static boolean getSwitchBoolean(String key, boolean defaultValue) { rtn = value != null ? Boolean.valueOf(value).booleanValue() : defaultValue; } catch (Exception e) { rtn = defaultValue; - LogUtil.fatalLog.error("corrupt switch value {}={}", new Object[]{key, switches.get(key)}); + LogUtil.fatalLog.error("corrupt switch value {}={}", key, switches.get(key)); } return rtn; } @@ -64,7 +64,7 @@ public static int getSwitchInteger(String key, int defaultValue) { rtn = status != null ? Integer.parseInt(status) : defaultValue; } catch (Exception e) { rtn = defaultValue; - LogUtil.fatalLog.error("corrupt switch value {}={}", new Object[]{key, switches.get(key)}); + LogUtil.fatalLog.error("corrupt switch value {}={}", key, switches.get(key)); } return rtn; } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/NotifySingleService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/NotifySingleService.java index 6248e46a542..a2024f8cf17 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/NotifySingleService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/NotifySingleService.java @@ -77,13 +77,15 @@ public void run() { this.isSuccess = PROCESSOR.process(GroupKey2.getKey(getDataId(), getGroup()), this); } catch (Exception e) { // never goes here, but in case (运行中never中断此通知线程) this.isSuccess = false; - LogUtil.notifyLog.error("[notify-exception] target:{} dataid:{} group:{} ts:{}", new Object[]{target, getDataId(), getGroup(), getLastModified()}); + LogUtil.notifyLog.error("[notify-exception] target:{} dataid:{} group:{} ts:{}", target, getDataId(), + getGroup(), getLastModified()); LogUtil.notifyLog.debug("[notify-exception] target:{} dataid:{} group:{} ts:{}", new Object[] { target, getDataId(), getGroup(), getLastModified() }, e); } if (!this.isSuccess) { - LogUtil.notifyLog.error("[notify-retry] target:{} dataid:{} group:{} ts:{}", new Object[]{target, getDataId(), getGroup(), getLastModified()}); + LogUtil.notifyLog.error("[notify-retry] target:{} dataid:{} group:{} ts:{}", target, getDataId(), + getGroup(), getLastModified()); try { ((ScheduledThreadPoolExecutor) executor).schedule(this, 500L, TimeUnit.MILLISECONDS); } catch (Exception e) { // 通知虽然失败,但是同时此前节点也下线了 diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/trace/ConfigTraceService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/trace/ConfigTraceService.java index ae027185128..83e87ae0742 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/trace/ConfigTraceService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/trace/ConfigTraceService.java @@ -56,7 +56,8 @@ public static void logPersistenceEvent(String dataId, String group, String tenan } //localIp | dataid | group | tenant | requestIpAppName | ts | handleIp | event | type | [delayed = -1] | ext(md5) String md5 = content == null ? null : MD5.getInstance().getMD5String(content); - LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", new Object[]{SystemConfig.LOCAL_IP, dataId, group, tenant, requestIpAppName, ts, handleIp, "persist", type, -1, md5}); + LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", SystemConfig.LOCAL_IP, dataId, group, tenant, + requestIpAppName, ts, handleIp, "persist", type, -1, md5); } public static void logNotifyEvent(String dataId, String group, String tenant, String requestIpAppName, long ts, String handleIp, String type,long delayed, String targetIp) { @@ -68,7 +69,8 @@ public static void logNotifyEvent(String dataId, String group, String tenant, St tenant = null; } //localIp | dataid | group | tenant | requestIpAppName | ts | handleIp | event | type | [delayed] | ext(targetIp) - LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", new Object[]{SystemConfig.LOCAL_IP, dataId, group, tenant, requestIpAppName, ts, handleIp, "notify", type, delayed, targetIp}); + LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", SystemConfig.LOCAL_IP, dataId, group, tenant, + requestIpAppName, ts, handleIp, "notify", type, delayed, targetIp); } public static void logDumpEvent(String dataId, String group, String tenant, String requestIpAppName, long ts, String handleIp, String type, long delayed, long length) { @@ -80,7 +82,8 @@ public static void logDumpEvent(String dataId, String group, String tenant, Stri tenant = null; } //localIp | dataid | group | tenant | requestIpAppName | ts | handleIp | event | type | [delayed] | length - LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", new Object[]{SystemConfig.LOCAL_IP, dataId, group, tenant, requestIpAppName, ts, handleIp, "dump", type, delayed, length}); + LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", SystemConfig.LOCAL_IP, dataId, group, tenant, + requestIpAppName, ts, handleIp, "dump", type, delayed, length); } public static void logDumpAllEvent(String dataId, String group, String tenant, String requestIpAppName, long ts, String handleIp, String type) { @@ -92,7 +95,8 @@ public static void logDumpAllEvent(String dataId, String group, String tenant, S tenant = null; } //localIp | dataid | group | tenant | requestIpAppName | ts | handleIp | event | type | [delayed = -1] - LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", new Object[]{SystemConfig.LOCAL_IP, dataId, group, tenant, requestIpAppName, ts, handleIp, "dump-all", type, -1}); + LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", SystemConfig.LOCAL_IP, dataId, group, tenant, + requestIpAppName, ts, handleIp, "dump-all", type, -1); } public static void logPullEvent(String dataId, String group, String tenant, String requestIpAppName, long ts, String type, long delayed, String clientIp) { @@ -104,6 +108,7 @@ public static void logPullEvent(String dataId, String group, String tenant, Stri tenant = null; } //localIp | dataid | group | tenant| requestIpAppName| ts | event | type | [delayed] | ext(clientIp) - LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", new Object[]{SystemConfig.LOCAL_IP, dataId, group, tenant, requestIpAppName, ts, "pull", type, delayed, clientIp}); + LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", SystemConfig.LOCAL_IP, dataId, group, tenant, + requestIpAppName, ts, "pull", type, delayed, clientIp); } } diff --git a/pom.xml b/pom.xml index ad9e6cb986d..87cc8c1f37f 100644 --- a/pom.xml +++ b/pom.xml @@ -571,11 +571,6 @@ jackson-core-asl 1.9.10 - - com.taobao.middleware - logger.api - 0.2.1-SNAPSHOT - apache-log4j log4j