Using application trace at run time
At run time, you can enable one or more applications for application trace.
The Example HelloWorld with application trace uses the
Trace.set() API to pass arguments to the trace function. For example, to pass the
iprint argument to the trace function, use the following
command:
java -mp . -m HelloWorld iprint=HelloWorld
Starting the example HelloWorld application
in this way produces the following results:
Trace setting: iprint=HelloWorld
09:50:29.417*0x2a08a00 084002 - Event id 1, text = Trace initialized
09:50:29.417 0x2a08a00 084000 > Entering sayHello
Hello
09:50:29.427 0x2a08a00 084001 < Exiting sayHello
09:50:29.427 0x2a08a00 084000 > Entering sayGoodbye
Bye
09:50:29.437 0x2a08a00 084004 * < Exception exit from sayGoodbye
You can also specify trace options directly by using the -Xtrace option. See
-Xtrace for more details. For example, you can obtain a similar result to the previous
command by using the -Xtrace option to specify iprint on
the command
line:
java -mp . -m -Xtrace:iprint=HelloWorld HelloWorld
Note: You
can enable tracepoints by application name and by tracepoint number. Using tracepoint levels or
types is not supported for application trace.