xlogin / arthas-demo

Arthas demo

Home Page:https://alibaba.github.io/arthas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

简介

Arthas排查spring boot问题的案例。

为了Clone更快和演示更方便,对@断岭原工程的示例代码进行了部分修改和整合。

链接

打个广告,Arthas正在征集使用者,您的使用是对我们最大的支持。 如果Arthas对您排找问题有帮助,请到这里来登记下,并在30分钟内成为Arthas Contributor:

alibaba/arthas#395

命令列表

0. 安装Arthas

wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar

1. Dashboard

dashboard

2. Thread

找出当前最繁忙的top3线程,取样间隔为1秒

thread -n 3 -i 1000

3. Classloader

展示Classloader信息

classloader -t

4. Sc

展示类加载信息

sc -d java.lang.String
sc -d -f -x 2 com.taobao.arthas.demo.web.UserController

5. Watch

监控方法调用人参/异常值

watch com.taobao.arthas.demo.web.UserController * '{params[0], throwExp}' 'true'

6. Trace

监控方法调用栈,统计调用时间

trace  com.taobao.arthas.demo.web.UserController findUserById2 > trace.log

7. Jad

反编译

jad --source-only com.taobao.arthas.demo.web.UserController > UserController.java

8. Mc

内存编译器

mc UserController.java

9. Redefine

热更新

redefine -c 18b4aac2 ${CLASS_PATH}

10. OGNL

查看LOGGER实现类

ognl '@com.taobao.arthas.demo.web.UserController@LOGGER'

动态修改LOGGER LEVEL

ognl '@com.taobao.arthas.demo.web.UserController   @LOGGER.setLevel(@ch.qos.logback.classic.Level@DEBUG)'

获取加载的日志配置文件

ognl '#map1=@org.slf4j.LoggerFactory@getLogger("root").loggerContext.objectMap, #map1.get("CONFIGURATION_WATCH_LIST")'

About

Arthas demo

https://alibaba.github.io/arthas

License:Apache License 2.0


Languages

Language:Java 91.7%Language:FreeMarker 8.3%