Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log/trace any method call of object in java

I need some thing like a Python decorator. I need to store some information, specifically the method called, its start time, its end time, and its arguments. I cannot import anything outside of Java 1.5 libraries. Is there some thing like what is available in Python?

like image 788
waldecir Avatar asked Dec 27 '22 15:12

waldecir


2 Answers

Good tracing tool for Java is BTrace.

like image 51
umbr Avatar answered Dec 30 '22 09:12

umbr


You can try some profiler using Java Management Extensions or java agent.

See http://java.sun.com/developer/technicalArticles/releases/j2se15/#mnm

like image 21
Michał Šrajer Avatar answered Dec 30 '22 10:12

Michał Šrajer