Logging a methods's name and parameters

前端 未结 4 1486
星月不相逢
星月不相逢 2021-02-10 15:12

I\'ve been working with a company that, in this current project, has to implement a policy of writing lots of trace logging in code (JAVA) that has already been completed for so

4条回答
  •  走了就别回头了
    2021-02-10 15:37

    The best way is to use AOP and Java annotations. I would recommend to use @Loggable annotation and an AspectJ aspect from jcabi-aspects (I'm a developer):

    @Loggable(Loggable.DEBUG)
    public String load(URL url) {
      return url.openConnection().getContent();
    }
    

提交回复
热议问题