Wednesday, May 27, 2009

BTrace the ultimate JVM probe

I have been working with BTrace in the last few months and the more I use it the more I appreciate it. BTrace enables you to write a small java class that will instrument you java application on the fly and will give you ultimate flexibiliy to pin-point the requested information.
It can help in debugging/ profiling/ deadlock analysis and solving other stability problems
I am going to give a session 2.5 hours session on the 1/7 in Israel(Petah Tikva). Details will follow..... If you want to attend send me an email to
Here is a tricky example which will help you identify where in the code a you write a certaion message to stdout..... enjoy!

package com.scalablej.btrace;

import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;

@BTrace public class PrintlnLocator {
clazz = "",
method = "println",
location = @Location(value = Kind.ENTRY))
public static void onPrint(Object a, String l) {
boolean b = compare(
get(field(classForName("java.lang.System"), "out")), a);
if (b) {


No comments: