JVM 11 GC日志循环:使用选项“(null)”初始化输出“file=/var/log/cassandra/gc.log”失败

dgjrabp2  于 2023-04-11  发布在  Cassandra
关注(0)|答案(1)|浏览(218)

我正在尝试更新一些旧的JVM GC日志循环选项,以兼容Java 11。以前,使用Java 8时,我有:

-Xloggc:/var/log/cassandra/gc.log"
-XX:+UseGCLogFileRotation"
-XX:NumberOfGCLogFiles=10"
-XX:GCLogFileSize=10M

然而,现在最后三个是无效的,我一直在徒劳地试图找出正确的替代品。我看了任何数量的博客和SO问题,但不能得到他们的权利。
最后一次尝试是:

JVM_OPTS="$JVM_OPTS -Xloggc:filesize=10M:filecount=10"
JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log"

结果是:

[0.002s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:filesize=10M:filecount=10 instead.
[0.002s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:/var/log/cassandra/gc.log instead.
[0.002s][error  ][logging] Initialization of output 'file=/var/log/cassandra/gc.log' using options '(null)' failed.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

(奇怪的是,如果我更改我的选项以包含额外的:,它会告诉我它是无效的)
我试过:

-Xlog:gc:none:/var/log/cassandra/gc.log:filesize=10M:filecount=10

-Xlog:gc:none:file=/var/log/cassandra/gc.log:filesize=10M:filecount=10

-Xloggc:/var/log/cassandra/gc.log
-Xlog:gc:::filesize=10M:filecount=10

-Xlog:gc,safepoint:gc.log::filecount=10,filesize=10M

-Xlog:gc*,safepoint:gc.log:time,uptime:filecount=10,filesize=10M

我尝试过的都不起作用,要么是无效参数的错误,要么是上面的(null)错误。
我所要做的就是让我的gc.log文件在达到10M时滚动,保留其中的10个,并写入/var/log/cassandra/gc.log

编辑

完全移除旋转参数

-Xloggc:/var/log/cassandra/gc.log

给我同样的错误

[0.002s][error  ][logging] Initialization of output 'file=/var/log/cassandra/gc.log' using options '(null)' failed.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
q8l4jmvw

q8l4jmvw1#

如果这是为了让Cassandra 2.1运行,那么可以运行它的最高Java版本是Java 8。
如果你想在Java 11上运行Cassandra,你需要升级到Cassandra 4.0或4.1。

相关问题