[英]Java: Print every method called to console?
I need to understand a quite large Java project. 我需要了解一个非常大的Java项目。 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). 我用eclipse浏览它并使用调用层次结构和所有,但这并不能让我了解项目运行时发生的事情(它是一个web服务)。
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? 例如,某种框架提供了什么?
You should try to use Aspect-oriented programming (AOP). 您应该尝试使用面向方面编程 (AOP)。
Here is an example that does more or less what you want: How to use AOP with AspectJ for logging? 这是一个或多或少做你想要的例子: 如何使用AOP和AspectJ进行日志记录?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.