Sundararajan's Weblog

BTrace - a dynamic tracing tool for Java

Guest Author

Are you interested in a byte code instrumentation (BCI) based dynamic tracing solution for the Java platform? If so, please visit https://btrace.dev.java.net. BTrace is a safe, dynamic tracing solution for Java. You can express tracing code in Java and run it against a running Java application. Your Java application should be running on JDK 6 or above for BTrace to work. You may be using VisualVM, the all-in-one Java troubleshooting tool. VisualVM supports plugin model to extend it's capabilities. BTrace plugin for VisualVM will be available soon. When BTrace plugin is available, you can trace your application from VisualVM tool. In the meanwhile, you can use BTrace command line tools.
You may want to check out the user guide for the command line access.

Join the discussion

Comments ( 8 )
  • AdaptJ Friday, March 7, 2008

    StackTrace provides similar functionality for older JVMs where dynamic byte code instrumentation is not possible.


  • Eugene Kuleshov Friday, March 7, 2008

    Would you mind to write up some info about BTrace for the ASM users page at http://asm.objectweb.org/users.html ?

  • A. Sundararajan Friday, March 7, 2008

    Hi "AdaptJ" - I did a quick glance at Adaptj. But, will take a detailed look later. In the meanwhile, please check out whether there are common elements that can be used across the tools.

    Hi Eugene Kuleshov - I'll send you a write up about BTrace for ASM users page.

  • A. Sundrarajan Monday, March 10, 2008

    Hi Eugene: Not sure my description for "ASM users" page reached you or not by email. I'm reproducing the same here:

    BTrace (https://btrace.dev.java.net) is a safe, dynamic tracing tool for the Java platform. BTrace works by dynamically bytecode instrumenting (BCI) .class files of running a Java application to insert tracing code. The tracing code is expressed in Java programming language. BTrace uses ASM 3.0 to instrument .class files at runtime. On OpenSolaris platform, there is integration with OpenSolaris DTrace (dynamic tracing for Solaris OS and applications) as well. It is possible to raise DTrace probes from BTrace code and also execute an associated D-script. There is a command line access as well as GUI access to BTrace. VisualVM (http://visualvm.dev.java.net) is all-in-one troubleshooting tool for Java. VisualVM supports plugin model to extend it's capabilities. A VisualVM plugin for BTrace is being developed. It will be available soon.

  • Curt Cox Monday, March 10, 2008

    If that appeals to you, you might also be interested in JIP : The Java Interactive Profiler.


  • William Louth Tuesday, March 11, 2008

    Since this is not really targeted at performance how does compare to JXInsight's Diagnostics which provides a debugger like interface but at a much higher level of abstraction. One immediate difference is that JXInsight is based on a execution and meta model which can be pulled on-demand from a remote console rather than the obvious push and unfiltered System.out like statement mechanism offered here.

    Diagnostics Tutorial


    Component State in Diagnostics Global Frame



  • madhu Tuesday, March 18, 2008

    How to print method arguments. For example if I add probe to monitor Socket.connect method. How do I print arguments passed to connect method.

    Also how this dynamic tracing works ?.


  • A. Sundararajan Tuesday, March 18, 2008

    Yes, you can print arguments. Please see "SocketTracker.java", "SocketTracker1.java", "ArgArray.java" samples in BTrace "samples" directory.

    BTrace works by instrumenting .class files loaded in the target application and hot-swapping (a.k.a redefine classes) those.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.