Probably the most acclaimed technology to come out of Sun Microsystems recently is
DTrace, the dynamic tracing framework for Solaris (which Apple also ported for and included in Leopard).
DTrace allows to inject so-called probes into the running operating system and applications
in order to gather data to tune or troubleshoot them. Probes are written in a simple programming language
called D, creating probes requires no changes to the code being probed, and
DTrace support has no performance impact unless the probes are actually enabled.
I really want to have something similar for Java, in order to troubleshoot tricky
support issues at customer sites. At least a simple version (with only JVM-level
and no application-specific instrumentation points) should be possible using the existing
JVM tracing and debugging interfaces. I picture something like inserting a little script
that fires when a specific method is called with a specific set of arguments and then logs a message
or starts a timer or increases a counter. Half a day of searching did unfortunately not turn
up an easy-to-use and painless-to-deploy tool, although I am sure there must be something.
As it is, we have to rely on logging, the catch being, of course, that appropriate trace messages
need to be in the code in the first place, which more often than not they are not, requiring
a patch release with all the costs and delays associated to it. And even if the messages are there,
they of course only appear when trace logging is enabled, and even when only enabling tracing for the
bare minimum of log categories required, there will usually be a lot of output unrelated to the problem
at hand that need to be manually filtered.
Update: I am aware that DTrace is available on the latest JVM for Solaris and
Mac OS X, but that will not help me with Java5 on RedHat, which is what we deploy on. I was looking for a Javaland solution
that works with older/other JVM/OS.