From a50115304f775bbc5dd6215660f04073d3a1a622 Mon Sep 17 00:00:00 2001 From: wizzercn Date: Tue, 24 Mar 2020 15:30:30 +0800 Subject: [PATCH] =?UTF-8?q?fxi:=20starter-logbcak-exts=20=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=89=8D=E7=BC=80=E6=B2=A1=E6=94=B9=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starter/logback/exts/loglevel/LoglevelService.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nutzboot-starter/nutzboot-starter-logback-exts/src/main/java/org/nutz/boot/starter/logback/exts/loglevel/LoglevelService.java b/nutzboot-starter/nutzboot-starter-logback-exts/src/main/java/org/nutz/boot/starter/logback/exts/loglevel/LoglevelService.java index d1af3454..cf66d802 100644 --- a/nutzboot-starter/nutzboot-starter-logback-exts/src/main/java/org/nutz/boot/starter/logback/exts/loglevel/LoglevelService.java +++ b/nutzboot-starter/nutzboot-starter-logback-exts/src/main/java/org/nutz/boot/starter/logback/exts/loglevel/LoglevelService.java @@ -17,8 +17,6 @@ import org.slf4j.LoggerFactory; import java.util.Set; -import static org.nutz.boot.starter.logback.exts.loglevel.LoglevelProperty.REDIS_KEY_PREFIX; - @IocBean(create = "init") public class LoglevelService implements PubSub { private static final Log log = Logs.get(); @@ -35,7 +33,7 @@ public class LoglevelService implements PubSub { * 初始化数据到redis并订阅主题 */ public void init() { - pubSubService.reg(REDIS_KEY_PREFIX + "pubsub", this); + pubSubService.reg(loglevelProperty.REDIS_KEY_PREFIX + "pubsub", this); saveToRedis(); doHeartbeat(); } @@ -57,7 +55,7 @@ public class LoglevelService implements PubSub { loglevelProperty.setVmUse(vmUse); loglevelProperty.setLoglevel(getLevel()); //log.debug("LoglevelService saveToRedis::"+Json.toJson(loglevelProperty)); - redisService.setex(REDIS_KEY_PREFIX + "list:" + loglevelProperty.getName() + ":" + loglevelProperty.getProcessId(), loglevelProperty.getKeepalive(), Json.toJson(loglevelProperty, JsonFormat.compact())); + redisService.setex(loglevelProperty.REDIS_KEY_PREFIX + "list:" + loglevelProperty.getName() + ":" + loglevelProperty.getProcessId(), loglevelProperty.getKeepalive(), Json.toJson(loglevelProperty, JsonFormat.compact())); } /** @@ -73,7 +71,7 @@ public class LoglevelService implements PubSub { * @param loglevelCommand */ public void changeLoglevel(LoglevelCommand loglevelCommand) { - pubSubService.fire(REDIS_KEY_PREFIX + "pubsub", Json.toJson(loglevelCommand, JsonFormat.compact())); + pubSubService.fire(loglevelProperty.REDIS_KEY_PREFIX + "pubsub", Json.toJson(loglevelCommand, JsonFormat.compact())); } /** @@ -152,7 +150,7 @@ public class LoglevelService implements PubSub { * @return */ public NutMap getData() { - Set set = redisService.keys(REDIS_KEY_PREFIX + "list:*"); + Set set = redisService.keys(loglevelProperty.REDIS_KEY_PREFIX + "list:*"); NutMap map = NutMap.NEW(); for (String key : set) { String[] keys = key.split(":");