alibaba arthas 学习

1. 源码地址: 

 https://github.com/alibaba/arthas.git

2. 官方文档

https://arthas.aliyun.com/doc/

curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar

3. 使用

1)先监控eclipse进程,事实证明卡住不动了,arthas不能监控非web项目(也许是eclipse太大了)

2)正规web项目

3)dashboard ,循环显示

4)thread

5)jad  包+类  直接反编译,(感觉这个有用,需要的时候可以看线上代码和本地是否一致)

6) watch

$ watch demo.MathGame primeFactors returnObj 查看函数返回值

这个暂时没有发现有返回

7).其他命令

8). 不支持其他机器用ip访问

Arthas目前支持Web Console,用户在attach成功之后,可以直接访问:http://127.0.0.1:3658/。

9).任务输出重定向

可通过>或者>>将任务输出结果输出到指定的文件中,可以和&一起使用,实现arthas命令的后台异步任务。比如:

$ trace Test t >> test.out &

10),查看日志级别,修改日志级别(这个也有用)

logger

查看指定名字的logger信息

 logger -n org.springframework.web

有时需要加classloaderhash:

logger -c 377dca04 --name DAO.LOG --level error     

11). spring boot 集成 (暂未实践)

        <dependency>
            <groupId>com.taobao.arthas</groupId>
            <artifactId>arthas-spring-boot-starter</artifactId>
            <version>${arthas.version}</version>
        </dependency>

     

arthas.agent-id=hsehdfsfghhwertyfad
arthas.tunnel-server=ws://47.75.156.201:7777/ws

http://localhost:8080/actuator/arthas

{
    "arthasConfigMap": {
        "agent-id": "hsehdfsfghhwertyfad",
        "tunnel-server": "ws://47.75.156.201:7777/ws",
    }
}

猜你喜欢

转载自blog.csdn.net/yunxing323/article/details/109586847