logger
查看logger信息,修改日志级别
命令选项
命令选项 | 描述 |
---|---|
-c, --classloader <hash> | 指定ClassLoader实例的hash码 |
--classloaderClass <name> | 指定ClassLoader的类 |
--include-no-appender | 包含没有appender的logger,默认false,开启结果通常比较长 |
-l, --level <value> | 设置日志级别 |
-n, --name <value> | 日志名称 |
-h, --help | 帮助 |
示例
注意
日志级别设置后,Arthas退出时不会还原日志级别,需要再次设置
bash
# 查看logger
[arthas@21536]$ logger
name ROOT
class ch.qos.logback.classic.Logger
classLoader sun.misc.Launcher$AppClassLoader@18b4aac2
classLoaderHash 18b4aac2
level INFO
effectiveLevel INFO
additivity true
codeSource file:/D:/.m2/repository/ch/qos/logback/logback-classic/1.2.5/logback-classic-1.2.5.jar
appenders name STDOUT
class ch.qos.logback.core.ConsoleAppender
classLoader sun.misc.Launcher$AppClassLoader@18b4aac2
classLoaderHash 18b4aac2
target System.out
# 指定名字查看logger
[arthas@21536]$ logger -n org.springframework
name org.springframework
class ch.qos.logback.classic.Logger
classLoader sun.misc.Launcher$AppClassLoader@18b4aac2
classLoaderHash 18b4aac2
level WARN
effectiveLevel WARN
additivity true
codeSource file:/D:/.m2/repository/ch/qos/logback/logback-classic/1.2.5/logback-classic-1.2.5.jar
# 查看指定ClassLoader的logger
[arthas@21536]$ logger -c 18b4aac2
name ROOT
class ch.qos.logback.classic.Logger
classLoader sun.misc.Launcher$AppClassLoader@18b4aac2
classLoaderHash 18b4aac2
level INFO
effectiveLevel INFO
additivity true
codeSource file:/D:/.m2/repository/ch/qos/logback/logback-classic/1.2.5/logback-classic-1.2.5.jar
appenders name STDOUT
class ch.qos.logback.core.ConsoleAppender
classLoader sun.misc.Launcher$AppClassLoader@18b4aac2
classLoaderHash 18b4aac2
target System.out
# 设置日志级别
[arthas@21536]$ logger -n org.springframework -l DEBUG
Update logger level success.
# 指定 classloader 更新 logger level
# 默认情况下,logger 命令会在 SystemClassloader 下执行,
# 如果应用是传统的war应用,或者 spring boot fat jar 启动的应用,那么需要指定 classloader。
[arthas@21536]$ logger -c 18b4aac2 -n ROOT -l DEBUG
Update logger level success.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52