“This is the 31st day of my participation in the August Gwen Challenge.
🔉 introduction
Today is 31 days, this month is very touched, also very grateful, touched, moved by myself is done every day more tasks, and also can and so many friends together, gratitude is without this activity, may also won’t have the condition of I, we all want to thank every success of your own luck and we choose, The last one was a little theory and a lot of crap.
Virtual machine and garbage collector logs
Solve the problem of the Java virtual machine memory is the most direct way is to look at the log, but it is a pity that the virtual machine log does not have a fixed specification, and does not have a unified before JDK9 log processing framework, this leads to various functional modules of virtual machines on the different parameters of the distribution of the log switch until JDK9, this chaotic situation just disappear, Logs for all functions are attributed to the -xlog parameter.
GC logs for JDK9
-Xlog
[:[selector][:[output][:[decorators][:output-options]]]]
The most critical argument on the command line is the Selector, which consists of a Tag and a log Level. A label can be understood as the name of a functional module in the virtual machine. It tells the logging framework which functions the user wants to log output from the virtual machine. The tag name of the garbage collector is “GC”, so the garbage collector log is just one of the many features of HotSpot. The tag names of all supported feature modules are as follows:
The log level is Trace, Debug, Info, Warning, Error, and Off. The log level determines the details of the output information. The default log level is Info. Additional information includes:
Time: indicates the current date and time. Uptime: indicates the time elapsed since the VM was started, in seconds. Timemillis: the number of milliseconds of the current time, equivalent to the output of System.currentTimemillis (). Uptimemillis: indicates the number of milliseconds elapsed since the VM was started. Timenanos: The number of nanoseconds of the current time, equivalent to the output of system.nanotime (). Uptimenanos: indicates the number of nanoseconds elapsed since the VM was started. Pid: indicates the ID of a process. Tid: indicates the ID of a thread. Level: indicates the log level. Tags: Set of tags for log output.
GC logs for JDK8
View basic GC information.
Query basic GC information:
As with basic GC information, use -xx :+PrintGCDetails before JDK 9; Results of viewing GC details: