fxi: starter-logbcak-exts 缓存前缀没改全

This commit is contained in:
wizzercn 2020-03-24 15:30:30 +08:00
parent 7685a12b15
commit a50115304f

View File

@ -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<String> set = redisService.keys(REDIS_KEY_PREFIX + "list:*");
Set<String> set = redisService.keys(loglevelProperty.REDIS_KEY_PREFIX + "list:*");
NutMap map = NutMap.NEW();
for (String key : set) {
String[] keys = key.split(":");