Common usage

Heat modified code

wget https://github.com/hengyunabc/katacoda-scenarios/raw/master/demo-arthas-spring-boot.jar

You can run sudo without the background, but note that you may need sudo permission
sudo java -jar demo-arthas-spring-boot.jar &

After entering arthas, select Spring-Boot
Re-define --> re-define --> re-define --> re-define --> re-define --> re-define

# 1. The decompiled output jad - source - only com. Example. Demo. Arthas. User. The UserController > / TMP/UserController. Java
# 2. The search to the corresponding class of classloadersc - d * UserController | grep this
/ TMP/userController.java -d/TMP
# 4. The heat load (without having to restart services), and non-intrusive, is just a temporary modification. Redefine/TMP/com/example/demo/arthas/user/UserController. ClassCopy the code

Sometimes the decompilation fails and you have to upload manually

Positioning error

#1. Watch confirms an empty class, assuming I modify class A. But I don't know which way
# observe the method input value, return value, throw exception three common parameters
watch xx.xx.A * '{params,returnObj,throwExp}' -x 2 
# expand the exception stack for layer 2, or more specifically, layer 3. You'll find the printed information quite detailed
#2. Generally, watch can kill 500 errors in a second. Trace can help us to consume time in the tree output, which is more clear, and will tell you which exception was thrown.
trace xx.xx.A * -j # do not print JDK methods, of course you can not *, but through watch after the smaller scope.Copy the code


Method Execution monitoring

monitor -c 5 demo.MathGame primeFactorsCopy the code

-c The default statistical period is 120s

Use ogNL expressions

If the number of calls to a method is increasing per unit of time, you can use OGNL to view the value of a variable (e.g., set, list)



See alibaba. Making. IO/arthas/inde…