4

I need to understand a quite large Java project. I browse through it with eclipse and use the call hierarchy and all, but that doesnt get me quite the idea on what is happening when the project runs (it's a webservice).

Is there a possibility to print out every method call with parameters to console? Basically something that puts

System.out.println("methodName, params: " + param1.toString());

in every method for me. Some kind of framework that provides that for example?

fweigl
  • 20,534
  • 19
  • 105
  • 196

1 Answers1

4

You should try to use Aspect-oriented programming (AOP).

Here is an example that does more or less what you want: How to use AOP with AspectJ for logging?

Community
  • 1
  • 1
maba
  • 45,597
  • 10
  • 105
  • 115
  • 1
    Thanks a bunch, although the topic seems intimidating at first, I got it all running :) For anyone else who wants to log their method calls but does not want to go deeper in the whole AOP thing, this is how it worked for me: * install AJDT to your eclipse * convert Java project to AspectJ project * copy- paste the Aspect code from with this tutorial: http://mathewjhall.wordpress.com/2011/03/31/tracing-java-method-execution-with-aspectj/ * Run project – fweigl Aug 17 '12 at 13:26