“This article has participated in the call for good writing activities, click to view: the back end, the big front end double track submission, 20,000 yuan prize pool waiting for you to challenge!”
Speaking of the debug we all are very familiar with, don’t know whether you know also can undertake the debug online, but it is important to note that remember that can only be used in the online test environment, so as not to cause system blocking can’t use, is only applicable to the online testing environment debugging code, and local code must agree with the online code, Otherwise unforeseen problems may occur.
- Project package
Package directly into jars using package after the clean project
- Idea configures remote JVM debugging
I’m just going to do a demo here in the local environment
- Start the packaged JAR in the server
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar xxx.jar
Copy the code
Parameter Description: Transport =dt_socket Indicates that data is transmitted in Socket mode. Server =y indicates that the server is debugging. Server =n Indicates that the client is debugging. Address =5005 Specifies the port number of the debug server, which requires the server to be open
- Start the REMOTE debugging of idea
You can see on the console that the prompt is remote to the JVM
It is now possible to debug remote code as if it were local. It is very convenient to debug specific problems that only occur online, and there are other very useful remote debugging tools such as Arthas, which have the opportunity to make a post.