My Wiki

July 25, 2006

How to enable Garbage Collection (GC) logs

Filed under: Java — jaikiran @ 10:19 am

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


1 Comment »

  1. How to add GC logs entry for Log4j?
    I have been facing this issue since past 1 week and have no idea how o fix the issue.

    The Issue is occurign in the production server and gc log gets over-provisioned with more than > 3 GB everyday.

    the GC logs, as of now, is being provision through a run.conf and we are rotating it through logrotate.

    All I need to put entry for GC in log4j so that FileAppender option could be put to remove those unusual characters like ^@^@ at the start of log file.

    Anyone who can help configuring GC log in log4j rather than simple run.conf and logrotate.

    Comment by Tuxbuddy — March 3, 2010 @ 8:20 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: