在jvm.properties中gc日志相关配置默认是注释掉的,放开对应配置项即可
## GC logging
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps
#-XX:+PrintClassHistogram
#-XX:+PrintTenuringDistribution
#-XX:+PrintGCApplicationStoppedTime
# log GC status to a file with time stamps
# ensure the directory exists
-Xloggc:${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-show-gc.log
# By default, the GC log file will not rotate.
# By uncommenting the lines below, the GC log file
# will be rotated every 128MB at most 32 times.
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=32
-XX:GCLogFileSize=1K
本文详细介绍了如何在JVM中配置GC日志,包括启用详细的GC信息、时间戳、日期戳等,并展示了如何设置日志文件的旋转策略,确保日志文件的有效管理和监控。
613

被折叠的 条评论
为什么被折叠?



