Logging GC output to a file, the differences between Xloggc and verbose:gc

I'm sure people have noticed this little idiosyncrasy in the way that garbage collection log output is handled in the JVM. But if you have not, this is a good data point when preparing to read through GC logs.

If you simply use the verbose:gc flag, you'll have GC log output sent to the stdout console. Now, if you use the -Xloggc:[filename] switch, the GC data will be sent to a log file which you can grep through later. But either way, you get the the same GC data ...right? Wrong.

The -Xloggc:[filename] switch has the additional effect of turning on the -XX:+PrintGCTimeStamps switch and hence gives your log files the added benefit of time stamps. Wierd! I'd expect both of these switches to have the same exact behavior. I might file an RFE or Bug on this tonight.

Oh, for those who want to use it, the -Xloggc switch was introduced in 1.4.0 and newer VMs.
Comments:

I think the assumption was probably made that other logging would be going to console so timestamps were not needed by default; you could get the timestamp or least relative position of the GC from the messages around it. However if you're sending it to a seperate file, then you definitely have no context, so without timestamps the messages would be guaranteed to be useless. Now, these days (thanks to the ubiquity of other logging mechanisms), that assumption could probably use revisiting. Especially since I can't think of a good reason to -not- include the timestamps...

Posted by Rob Meyer on June 09, 2004 at 05:06 PM PDT #

Post a Comment:
Comments are closed for this entry.
About

moazam

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today