mirror of
https://github.com/alibaba/arthas.git
synced 2026-10-21 05:51:38 +00:00
improve logger command error message. #1077
This commit is contained in:
@@ -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的信息
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user