diff --git a/core/src/main/java/com/taobao/arthas/core/command/logger/LoggerCommand.java b/core/src/main/java/com/taobao/arthas/core/command/logger/LoggerCommand.java index 9fce86bc5..2908b0488 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/logger/LoggerCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/logger/LoggerCommand.java @@ -39,10 +39,16 @@ import com.taobao.text.util.RenderUtil; * @author hengyunabc 2019-09-04 * */ +//@formatter:off @Name("logger") @Summary("Print logger info, and update the logger level") -@Description("\nExamples:\n" + " logger\n" + " logger -c 327a647b\n" - + " logger -c 327a647b --name ROOT --level debug\n" + Constants.WIKI + Constants.WIKI_HOME + "logger") +@Description("\nExamples:\n" + + " logger\n" + + " logger -c 327a647b\n" + + " logger -c 327a647b --name ROOT --level debug\n" + + " logger --include-no-appender\n" + + Constants.WIKI + Constants.WIKI_HOME + "logger") +//@formatter:on public class LoggerCommand extends AnnotatedCommand { private static final Logger logger = LogUtil.getArthasLogger(); @@ -159,9 +165,9 @@ public class LoggerCommand extends AnnotatedCommand { } if (result) { - process.write("update logger level success.\n"); + process.write("Update logger level success.\n"); } else { - process.write("update logger level fail.\n"); + process.write("Update logger level fail. Try to specify the classloader with the -c option. Use `sc -d CLASSNAME` to find out the classloader hashcode.\n"); } } diff --git a/site/src/site/sphinx/en/logger.md b/site/src/site/sphinx/en/logger.md index 53208579c..960cf297f 100644 --- a/site/src/site/sphinx/en/logger.md +++ b/site/src/site/sphinx/en/logger.md @@ -130,6 +130,16 @@ In the `appenders` section: update logger level success. ``` +#### 指定classloader更新 logger level + +默认情况下,logger命令会在SystemClassloader下执行,如果应用是传统的`war`应用,或者spring boot fat jar启动的应用,那么需要指定classloader。 + +可以先用 `sc -d yourClassName` 来查看具体的 classloader hashcode,然后在更新level时指定classloader: + +```bash +[arthas@2062]$ logger -c 2a139a55 --name ROOT --level debug +``` + #### View the logger information without appenders diff --git a/site/src/site/sphinx/logger.md b/site/src/site/sphinx/logger.md index bf528d8d6..1d8f18208 100644 --- a/site/src/site/sphinx/logger.md +++ b/site/src/site/sphinx/logger.md @@ -131,6 +131,16 @@ logger update logger level success. ``` +#### 指定classloader更新 logger level + +默认情况下,logger命令会在SystemClassloader下执行,如果应用是传统的`war`应用,或者spring boot fat jar启动的应用,那么需要指定classloader。 + +可以先用 `sc -d yourClassName` 来查看具体的 classloader hashcode,然后在更新level时指定classloader: + +```bash +[arthas@2062]$ logger -c 2a139a55 --name ROOT --level debug +``` + #### 查看没有appender的logger的信息