java runtime tracing library to replace system.out.println

Posted by Grzegorz Oledzki on Stack Overflow See other posts from Stack Overflow or by Grzegorz Oledzki
Published on 2010-12-29T23:31:45Z Indexed on 2010/12/29 23:54 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

Have you heard of any library which would allow me to set up a tracing for specific methods at runtime?

Instead of adding (and removing) lots of System.out.println in my code (and having to re-compile and re-deploy) I would like to have a magic thing which would print out a line for each call of selected method without any change in the code. This would work without re-compiling, so some kind of JVM agent (or some non-standard JVM would be needed?). Sounds like a job for aspect programming?

A typical scenario would be to start an application, configure the traced methods dynamically (in a separate file or similar) and then everytime a selected method is called a line with its name (and arguments) is printed out to System.out (or some log file).

Naturally one could think of tens of additional features, but this basic set would be a great tool. BTW, I use Eclipse interactive debugger too, not only the System.out tracing technique, but both have some advantages and sometimes Eclipse is not enough.

© Stack Overflow or respective owner

Related posts about java

Related posts about debugging