简体   繁体   English

Java:打印调用控制台的每个方法?

[英]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.

相关问题 Java:如何在控制台和文件中打印控制台的每个输出? - Java: How to print every output of the console either in the console and in a file? RX Java 为每个 Observable 调用 2 个 onComplete 方法 - RX Java 2 onComplete method called for every Observable 无法获取构造函数方法以使用Java打印到控制台 - Cannot get constructor method to print to the console in Java 为什么调用异常方法的printstacktrace()不会打印到控制台? - Why is printstacktrace() of exception method does not print to console when ever called? 使用用户定义的方法将行打印到Java中的控制台 - Using user defined method to print line to console in java 调用的方法不打印 - method called does not print 在 JAVA 中打印到控制台 - Print to console in JAVA 监视每个被调用的方法 - Monitor every method being called 当通过 method.invoke() 调用 java 方法时,它不返回任何值,而是在控制台日志中打印 - when invoking a java method by method.invoke() its not returning any value instead print in the console log 我们可以在控制台上打印java消息而不使用main方法,静态变量和静态方法吗? - Can we print a java message on console without using main method, static variable and static method?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM