java - Write log when call request action in Spring Controller -


i want write log everytime action call. write log every action this:

   public string init() {             log.info("init search form"); // want log action name (init) here             return "initsearch";     } 

is there better way that? i'm researching interceptor still don't know how implement

only interceptors, mentioned yourself.

in order implement interceptor should implement class handlerinterceptoradapter

and in spring configuration should wire interceptor request

<interceptors>     <interceptor>         <mapping path="/requestpath" />         <beans:bean class="com.path.yourinterceptorimpl"></beans:bean>     </interceptor> </interceptors> 

alternatively read through pretty tutorial using aop (aspect oriented programming) in spring using aspectj


Comments