improve logger command error message. #1077

pull/1078/head
hengyunabc 5 years ago
parent 8e6153c320
commit 2ff0f551b8

@ -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");
}
}

@ -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

@ -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的信息

Loading…
Cancel
Save