0
点赞
收藏
分享

微信扫一扫

arthas 查看变量值的几种方式

码农K 2024-01-22 阅读 31

很多时候我们包含了一些变量,需要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

举报

相关推荐

0 条评论