karink
karink

Reputation: 21

configure Sun gc logging (JRE 1.6.0) with a rotating gc log

Is it possible to configure Sun gc logging (JRE 1.6.0) with a rotating gc log. currently I use the following hotspot options for logging:

-XX:+PrintGCTimeStamps -verbose:gc -Xloggc:/gc.log -XX:+PrintGCDetails

gc.log increases very fast and therefore I'd prefer to have a rolling one.

Upvotes: 2

Views: 1977

Answers (2)

Bubi S
Bubi S

Reputation: 103

You can't do it, but what we did was to write a script that monitor the files. And using "tail -f gc.log" copying the content from the original file to our file. Then, once every 10MB deletes the original file.

Upvotes: 0

Joe Kearney
Joe Kearney

Reputation: 7537

I don't believe that this is currently possible.

There are proposals to make this possible in the future (specifically with things like target file size and archive count before deleting old files), but for the moment you're left with one file per process.

If your gc log file is filling up quickly, you may want to see why and tune the VM accordingly to reduce memory pressure. You shouldn't expect your program to spend inordinate amounts of time in gc, unless you're doing crazy things on purpose!

Upvotes: 1

Related Questions