简体   繁体   中英

How to disable GC logs rotation

I used the -Xlog:gc:file option in my script file to log GC data in a file and I do not want this file to rotate everytime I execute the script file. However with the following property I can see the file is creating PrintGC.log.X (X is a number) files each time I execute the script file.

$JVM_MEM_OPTS \
    -Xlog:gc:file="$CARBON_HOME/repository/logs/printGC.log":time \

Any help that can disable this file rotation?

You are using Java 11+ logging options, and asking about Java 11.

In Java 11 (and later) you need this:

-Xlog:gc:file="$CARBON_HOME/repository/logs/printGC.log"::filecount=0:time

According to Enable Logging with the JVM Unified Logging Framework , the ::filecount=0 should disable log rotation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM