Use the output option to send trace data to <filename>.
If the file does not already exist, it is created automatically. If
it does already exist, it is overwritten.
Optionally:
- You can limit the file to size MB, at which
point it wraps to the beginning. If you do not limit the file, it
grows indefinitely, until limited by disk space.
- If you want the final trace filename to contain today's date,
the PID number that produced the trace, or the time, do one of the
following steps as appropriate (see also the examples at the end of
this section).
- To include today's date (in "yyyymmdd" format) in the trace filename,
specify "%d" as part of the <filename>.
- To include the pidnumber of the process that is generating the
tracefile, specify "%p" as part of the <filename>.
- To include the time (in 24-hour hhmmss format) in the trace filename,
specify "%t" as part of the <filename>.
- You can specify generations as a value 2 through 36. These values
cause up to 36 files to be used in a round-robin way when each file
reaches its size threshold. When a file needs to be reused, it is
overwritten. If generations is specified, the filename must contain
a "#" (hash, pound symbol), which will be substituted with its generation
identifier, the sequence of which is 0 through 9 followed by A through
Z.
Note: When tracing to a file, buffers for each thread are written
when the buffer is full or when the JVM terminates. If a thread has
been inactive for a period of time before JVM termination, what seems
to be 'old' trace data is written to the file. When formatted, it
then seems that trace data is missing from the other threads, but
this is an unavoidable side-effect of the buffer-per-thread design.
This effect becomes especially noticeable when you use the generation
facility, and format individual earlier generations.
Examples
- Trace output goes to /u/traces/gc.problem; no size limit:
-Xtrace:output=/u/traces/gc.problem,maximal=j9gc
- Output goes to trace and will wrap at 2 MB:
-Xtrace:output={trace,2m},maximal=j9gc
- Output goes to gc0.trc, gc1.trc, gc2.trc, each 10 MB in size:
-Xtrace:output={gc#.trc,10m,3},maximal=j9gc
- Output filename contains today's date in yyyymmdd format (for
example, traceout.20041025.trc):
-Xtrace:output=traceout.%d.trc,maximal=j9gc
- Output file contains the number of the process (the PID number)
that generated it (for example, tracefrompid2112.trc):
-Xtrace:output=tracefrompid%p.trc,maximal=j9gc
- Output filename contains the time in hhmmss format (for example,
traceout.080312.trc):
-Xtrace:output=traceout.%t.trc,maximal=j9gc