You can record everything using a CustomizableTraceInterceptor you can either set it in the xml configuration of your application context, or use AOP: (log level trace)
<bean id="customizableTraceInterceptor" class="org.springframework.aop.interceptor.CustomizableTraceInterceptor"> <property name="exitMessage" value="Leaving $[methodName](): $[returnValue]" /> </bean>
or you can fully customize it by running it in Java and using the setExitMessage () method:
public class TraceInterceptor extends CustomizableTraceInterceptor { private Logger log = LoggerFactory.getLogger("blabla"); @Override protected void writeToLog(Log logger, String message, Throwable ex) {
and use placeholders such as '$ [returnValue]'. A complete list can be found in the spring api documentation .
EDIT: Also, if you want to get the value of your @ResponseBody in another interceptor, I think this is not possible until version> 3.1.1. Check this issue: https://jira.springsource.org/browse/SPR-9226
source share