arthas 查看变量值的几种方式

很多时候我们包含了一些变量,需要check 变量的值,arthas 提供了几种方法

通过ognl

ognl 是一个强大的功能,可以看一些变量信息,比如静态类,静态字段的

  • 参考使用
ognl '@java.lang.System@out.println("hello")'

通过vmtool

vmtool 利用了JVMTI 接口,比ognl 更加强大,同时也支持与ognl 结合起来一起使用

  • 参考使用
vmtool --action getInstances --className com.dremio.dac.server.DACConfig  --express 'instances[0].allowTestApis' 

说明

使用好arthas,解决一些问题很方便

参考资料

https://arthas.aliyun.com/doc/ognl.html#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E
https://arthas.aliyun.com/doc/vmtool.html

posted on 2024-01-16 15:24  荣锋亮  阅读(1658)  评论(0编辑  收藏  举报

导航