Thursday, August 24, 2006

How to enable Garbage Collection (GC) logs


To enable GC logs, the -Xloggc:logFileName option will have to be passed when java command is being executed. Additionally if the detailed log of the GC is required, then an additional -XX:+PrintGCDetails option will have to be passed.

Example: java -Xloggc:D:/log/myLogFile.log -XX:+PrintGCDetails myProg 


4 comments:

  1. I can't get this command to work. verbose:gc works on its own, but the log file settings do not.

    mc1392@columbia.edu

    ReplyDelete
  2. Which Java version and vendor are you using?

    ReplyDelete
  3. but where to write this command in eclipse??

    ReplyDelete
  4. > but where to write this command in eclipse??
    Run configurations -> VM arguments

    ReplyDelete