To view logs online, use cat, head, tail, etc
Tail-100f xxxx. log Monitors the latest 100 lines of logs
Tail – 100 – f XXXX. The log | more displays, paging space on the next page, Ctrl + B back
Tail – 100 – f XXXX. The log | grep ‘keyword’
Tail -n 100 Displays the last 100 lines of the log
Free-h Displays the current memory usage
Df XXX Check the disk usage of the target directory
Common commands for troubleshooting problems online
- Top Displays the CPU usage of processes to locate faulty processes
- Top-hp [pid] Displays the running status of the target process and locates the faulty thread
- Printf “%x\n” XXX converts to hexadecimal
- Jstack -l [pid] | grep (dar) to look at the process of target problem thread running information, -l print extra lock information
- Jstat -gc [pid] [times] If the Thread in question is a GC Thread (VM Thread), use this command to check gc status
- Jmap-heap [pid] check heap configuration (jinfo also works)
- Jmap-dump :format=b,file= file name [PID] Dumps memory snapshots and analyzes them in combination with MAT