Short-term cloud computing training: Tracking garbage collection for Java virtual machines

Source: Internet
Author: User
The log of the JVM's GC is written in a replacement (>) instead of append (>>), and the previous GC content is emptied if it is written to the same file the next time. This causes the history of GC logs to be lost after we restart the Java service.

-xx:+printgc

-xx:+printgcdetails

-xx:+printgctimestamps

-xloggc:filename

Example

This will cause the GC log to be lost after the Java service restarts

-xx:+printgcdetails-xx:+printgctimestamps-xloggc:/data0/logs/gc.log

Here the GC logs support%p and%t two parameters:

%p will be replaced with the corresponding process PID

%t will be replaced by a time string in the form of: YYYY-MM-DD_HH-MM-SS

This way, the GC history log will not be lost, no matter how it restarts

-xx:+printgcdetails-xx:+printgcdatestamps-xloggc:/data0/logs/gc-%t.log "

Short-term cloud computing training: Tracking garbage collection for Java virtual machines

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.