From 8dfe26625b03eb1f1c0a6da91af88b13de5807c0 Mon Sep 17 00:00:00 2001 From: "394049428@qq.com" <394049428@qq.com> Date: Thu, 30 Jul 2020 14:37:56 +0800 Subject: [PATCH] fix logger command do not work with Log4j2. ##1394 #1395 --- .../taobao/arthas/core/command/logger/Log4j2Helper.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/taobao/arthas/core/command/logger/Log4j2Helper.java b/core/src/main/java/com/taobao/arthas/core/command/logger/Log4j2Helper.java index 31ded3713..bceeed802 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/logger/Log4j2Helper.java +++ b/core/src/main/java/com/taobao/arthas/core/command/logger/Log4j2Helper.java @@ -19,8 +19,6 @@ import org.apache.logging.log4j.core.appender.FileAppender; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.LoggerConfig; -import com.taobao.arthas.core.util.StringUtils; - /** * * @author hengyunabc 2019-09-20 @@ -96,7 +94,7 @@ public class Log4j2Helper { return loggerInfoMap; } // 排掉非root时,获取到root的logger config - if (!name.equalsIgnoreCase(LoggerConfig.ROOT) && StringUtils.isEmpty(loggerConfig.getName())) { + if (!name.equalsIgnoreCase(LoggerConfig.ROOT) && isEmpty(loggerConfig.getName())) { return loggerInfoMap; } loggerInfoMap.put(name, doGetLoggerInfo(loggerConfig)); @@ -190,4 +188,7 @@ public class Log4j2Helper { return result; } + private static boolean isEmpty(Object str) { + return str == null || "".equals(str); + } }