First of all, why do we need to do log management, in the real-time on-line we often encounter system anomalies or problems. This time immediately open the CRT or SSH connected to the server to take the day to analyze. are subject to various limitations of the network. So we thought why not directly in the management background to view the information of the error. So the log management appeared.
Second, the personal feel that doing the best log management is AOP, and some people like to use interceptors. Yes, I'll focus on my implementation here.
AOP Some people say that the controller is not intercepted. Some people say they want to stop Annotationmethodhandleradapter, and the controller has to intercept Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandl. Eradapter.
First, AOP can intercept the controller, which is no doubt that the second must intercept the annotationmethodhandleradapter is not necessary. At least I didn't prove it was successful. My spring version is 4.0.3.
AOP Some people say that the controller is not intercepted because the controller was the JDK agent. We just have to give it to the Cglib agent.
The first step defines two annotations:
It shows the addition of the incomplete method:
SPRINGAOP interception Controller,service Implementing log Management (how to customize annotations)