Running with method trace

Control method trace by using the command-line option -Xtrace:<option>.

To produce method trace you need to set trace options for the Java classes and methods you want to trace. You also need to route the method trace to the destination you require.

You must set the following two options:
  1. Use -Xtrace:methods to select which Java classes and methods you want to trace.
  2. Use either
    • -Xtrace:print to route the trace to stderr.
    • -Xtrace:maximal and -Xtrace:output to route the trace to a binary compressed file using memory buffers.

Use the methods parameter to control what is traced. For example, to trace all methods on the String class, set -Xtrace:methods=java/lang/String.*,print=mt.

The methods parameter is formally defined as follows:
-Xtrace:methods=[[!]<method_spec>[,...]]
Where <method_spec> is formally defined as:
{*|[*]<classname>[*]}.{*|[*]<methodname>[*]}[()]
Note:
Use the print, maximal and output options to route the trace to the required destination, where:

To produce method trace that is routed to stderr, use the print option, specifying mt (method trace). For example: -Xtrace:methods=java/lang/String.*,print=mt.

To produce method trace that is written to a binary file from the memory buffers, use the maximal and output options. For example: -Xtrace:methods=java/lang/String.*,maximal=mt,output=mytrace.trc.

If you want your trace output to contain only the tracepoints you specify, use the option -Xtrace:none to switch off the default tracepoints. For example: java -Xtrace:none -Xtrace:methods=java/lang/String.*,maximal=mt,output=mytrace.trc <class>.



© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)