使用AOP與註解記錄Java日誌

有些時候,我想要把每個運行過的方法接收到的參數、返回值和執行時間等信息記錄(通過slf4j 和 log4j)下來。在AspectJ、jcabi-aspects和Java註解的幫助下我實現了這個想法。 1 2 3 4 5 6 public class Foo {    @Loggable    public int power( int x, int p) {      return Math.po
相關文章
相關標籤/搜索