How to Enable Garbage Collection (GC) Logging on Bitbucket
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
目的
Garbage collection logs are useful when trying to isolate issues within Java-based applications as they will pinpoint blocked, hung or stuck threads that may be causing downstream effects in the application. It is always useful to collect at least 10 minutes of garbage collection logs, but analysis accuracy is often increased by the amount of recent log data to review.
ソリューション
Linux の場合
Add the following parameters in the $BITBUCKET_HOME/bin/_start-webapp.sh
file:
If you existing value assigned for JVM_SUPPORT_RECOMMENDED_ARGS
, please append the values.
For Java 17 and above:
JVM_SUPPORT_RECOMMENDED_ARGS="-Xloggc:$BITBUCKET_HOME/log/`date +%F_%H-%M-%S`-gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCCause -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M"
For Java 11:
JVM_SUPPORT_RECOMMENDED_ARGS="-Xlog:gc*:file=$BITBUCKET_HOME/log/gc-%t.log:tags,time,uptime,level:filecount=10,filesize=5M"
For Java 8:
JVM_SUPPORT_RECOMMENDED_ARGS="-Xloggc:$BITBUCKET_HOME/log/gc-%t.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCCause -XX:+UseG1GC -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20M"