Get execution path with ByteBuddy

Im trying to get the execution path of an application. To get in touch with ByteBuddy i implemented an agent using the code below but it doesn´t print out anything. Can anyone help me?

public static void premain(String arg, Instrumentation inst) throws Exception {

        new AgentBuilder.Default()
                .transform(new AgentBuilder.Transformer() {
                    public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassLoader classLoader, JavaModule javaModule) {
                        return builder.method(ElementMatchers.any()).intercept(;


 public static class LogInterceptor {
 static void log(@Origin Method method) {
        System.out.println(method.toString() + " was called");

I assume that your classes cannot invoke the package-private method. Byte Buddy does therefore refuse the instrumentation. If you install a listener to the agent builder, you can intercept this error.

You probably also want to invoke the original code after the print. You can add an andThen with a SuperMethodCall to do so.