Prabhashi
Prabhashi

Reputation: 128

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?

Upvotes: 0

Views: 1393

Answers (1)

Stephen C
Stephen C

Reputation: 719307

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.

Upvotes: 2

Related Questions