
As a sysadmin I sometimes face situations, where a program behaves abnormally, while not creating errors at all or creating nonsense error-messages. In the past - before java came in - there were two counter-measures:
I usually use Are there better ways to do that (if the source-code is not available)? |
|||
add a comment
|
As ckhan mentioned, Another useful tool is
This heap dump can be loaded in tools like Another tool, Finally, it is possible to use a Java Agent to push instrumentation on all methods of all objects at load-time. The library My Suggestion - start with VisualVM and see if that tells you what you need to know since it can show the current threads and important stats for the JVM. |
|||||
|

In the same vain when debugging programs that have gone awry on a Linux system you can use similar tools to debug running JVMs on your system. Tool #1 - jvmtopSimilar to
Its output is similarly styled to look like the tool
Tool #2 - jvmmonitorAnother alternative is to use jvmmonitor. JVM Monitor is a Java profiler integrated with Eclipse to monitor CPU, threads and memory usage of Java applications. You can either use it to automatically find running JVMs on the localhost or it can connect to remote JVMs using a port@host. Tool #3 - visualvmvisualvm is probably "the tool" to reach for when debugging issues with the JVM. Its feature set is pretty deep and you can get a very in depth look at the innards. Profile application performance or analyze memory allocation: Take and display thread dumps: References |
|||
Consider See also the suggestions at this SO article: http://stackoverflow.com/questions/1025681/call-trace-in-java |
||||
If you are using RHEL OpenJDK (or similiar, the point is that it is not Oracle's JDK), you may use SystemTap for that. Some probes are enabled by using java command line options Here is example SystemTap Script:
You can also use Note that SystemTap will trace every method. It is also not able to get method's arguments. Another option is to use JVM own capabilities of tracing which is called JVMTI. One of the most famous JVMTI implementations is BTrace. |