You can also watch ByteMan from JBoss. It uses the same Java agent mechanism and, in particular, supports the installation and removal of modification scripts, see the tutorial . The following is an abridged version of the tutorial:
For example, let's say we have several running Java processes:
$ jps 15295 Jps 4884 main
Then we can install ByteMan in the current process:
$ bminstall.sh 4884
Then you can create a ByteMan script:
$ youreditor thread.btm RULE trace thread start CLASS java.lang.Thread METHOD start() IF true DO traceln("*** start for thread: "+ $0.getName()) ENDRULE
Then you can install the ByeMan script with:
$ bmsubmit.sh -l thread.btm
To delete:
$ bmsubmit.sh -u thread.btm
To list what is currently being executed, simply release it without any arguments:
$ bmsubmit.sh
If you are running Windows, replace .sh in each command with .bat.
source share