Spring: Standard Logging aspect (interceptor)

前端 未结 2 2004
盖世英雄少女心
盖世英雄少女心 2020-11-28 06:30

I\'ve found a lot of examples on how to create a custom aspect for logging using the Spring framework like this or this but did not find standard/common Spring implementatio

2条回答
  •  春和景丽
    2020-11-28 07:00

    Here are the list of frameworks that do logging via AOP:

    http://aspect4log.sf.net - does very nice looking logging via slf4j and @Log annotation. Can work via SpringAOP, and AspectJ. With AspectJ it works even for private methods and constructors and does not require a class to be a Spring Bean. Very easy to use, i was able to make it running with my project within 5 min.

    http://loggifier.unkrig.de - does logging via java.util.logging, a bit too complex and not that well document but claims that it can instrument already compiled jar/war/ear files!

    AbstractTraceInterceptor (from SpringAOP) and it's subclasses SimpleTraceInterceptor and CustomizableTraceInterceptor. Logging configuration is done separately from classes. Logs via commons-logging. Since it is designed for SpringAOP you have to work with Spring Beans (and only with Spring Beans public methods).

提交回复
热议问题