title: Rolling garbage collector logs in java
body: <p>Is it possible to do a rolling of garbage collector logs in Sun JVM?</p>
  
  <p>Currently I generate logs using:</p>
  
  <pre><code>-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -verbose:gc -Xloggc:gc.log 
  </code></pre>
  
  <p>But I have to manually rotate them using fifo queues and rotatelogs to create a new log for each day. I hope that there is a better solution for this.</p>
  
  <p>Maybe there is a way to access this log entries from inside java so I could redirect them to log4j?</p>
  
  <p>Edit: the solution with fifo queue is not good enough because if the process that reads from this queue (e.g. rotatelogs) reads to slow it will slow down the entire jvm (apparently Sun/Oracle does gc logging synchronously)</p>