I have task of tracing some java application with dynamic probes (like dtrace or systemtap). Of course, it should be done without application restarts or recompiles. It should allow dynamic setting of interceptors on methods calls and internal JVM events. In solaris it could be done by dtrace, but not in other systems. How I can resolve this task?
-
2You can try https://github.com/alfredxiao/jackplay, which is exactly designed to allow you to enable tracing without code change or redeployment. It also allows you to redefine method body in JVM live. – Alfred Xiao Sep 05 '16 at 09:36
2 Answers
On linux (at least on fedora and red hat) you can do it with systemtap
, see this link for the explanation. It uses byteman to trace java applications. Though you can not use systemtap
on other platforms than linux, you can add byteman
to your project and use it on any os. Byteman allows user to inject custom code into running java classes, see documentation.

- 3,379
- 3
- 28
- 41
See: btrace (available via sdkman)
From the Github site:
"BTrace can be used to dynamically trace a running Java program (similar to DTrace for OpenSolaris applications and OS). BTrace dynamically instruments the classes of the target application to inject tracing code ("bytecode tracing")."
See: Getting Started
Also see this article for how to use DTrace to trace Java code: Java Profiling with DTrace

- 994
- 1
- 9
- 18