Rolling garbage collector logs in java

前端 未结 6 932
孤街浪徒
孤街浪徒 2020-12-08 04:12

Is it possible to do a rolling of garbage collector logs in Sun JVM?

Currently I generate logs using:

-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:         


        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 04:49

    I ended up solving this problem by spawning a new thread in my application and sending jcmd log-rotate command periodically (based on a cron expression).

    This is an unconventional approach as you will be using Oracle's Attach API, although the approach served our use case of rotating GC logs hourly.

提交回复
热议问题