At runtime, you can enable one or more applications for application trace.
java -Xgcpolicy:metronome HelloWorld iprint=HelloWorld
The
HelloWorld example uses the Trace.set() API to
pass any arguments to trace, enabling all of the HelloWorld tracepoints
to be routed to stderr. Starting the HelloWorld application in this
way produces the following output: 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
java -Xgcpolicy:metronome -Xtrace:iprint=HelloWorld HelloWorld
See Options that control tracepoint activation for more details.