IBM User Guide for Java V7 on Windows > Troubleshooting and support > Using diagnostic tools > Tracing Java applications and the JVM > Using method trace



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>[*]}[()]

Notes:

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>.


Parent: Using method trace








Error 404 - Not Found

Error 404 - Not Found

The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.