List of usage examples for org.springframework.aop.interceptor CustomizableTraceInterceptor setExitMessage
public void setExitMessage(String exitMessage)
From source file:com.capgemini.boot.trace.TraceLoggerConfigurationUtils.java
/** * Creates a trace interceptor for logging entry into and exit from methods. * @param settings the settings/*from w ww . j av a2s.c o m*/ * @return The created trace interceptor */ public static AbstractTraceInterceptor createTraceInterceptor(TraceLoggerSettings settings) { CustomizableTraceInterceptor customizableTraceInterceptor = new CustomizableTraceInterceptor(); customizableTraceInterceptor.setUseDynamicLogger(true); customizableTraceInterceptor.setEnterMessage(settings.getMessage().getEnter()); customizableTraceInterceptor.setExitMessage(settings.getMessage().getExit()); customizableTraceInterceptor.setExceptionMessage(settings.getMessage().getException()); return customizableTraceInterceptor; }
From source file:pl.java.scalatech.config.AopPerformanceLogConfig.java
@Bean public CustomizableTraceInterceptor interceptor() { CustomizableTraceInterceptor interceptor = new CustomizableTraceInterceptor(); interceptor.setEnterMessage("Entering => $[methodName]($[arguments])."); interceptor.setExitMessage( "Leaving => $[methodName](..) with return value $[returnValue], took $[invocationTime]ms."); return interceptor; }
From source file:example.springdata.jpa.interceptors.ApplicationConfiguration.java
public @Bean CustomizableTraceInterceptor interceptor() { CustomizableTraceInterceptor interceptor = new CustomizableTraceInterceptor(); interceptor.setEnterMessage("Entering $[methodName]($[arguments])."); interceptor.setExitMessage( "Leaving $[methodName](..) with return value $[returnValue], took $[invocationTime]ms."); return interceptor; }
From source file:org.spring.data.jpa.sample.interceptors.ApplicationConfiguration.java
@Bean public CustomizableTraceInterceptor interceptor() { CustomizableTraceInterceptor interceptor = new CustomizableTraceInterceptor(); interceptor.setEnterMessage("Entering $[methodName]($[arguments])."); interceptor.setExitMessage( "Leaving $[methodName](..) with return value $[returnValue], took $[invocationTime]ms."); return interceptor; }
From source file:fr.univlorraine.mondossierweb.config.DebugConfig.java
/** * Interceptor permettant de logger les appels aux mthodes * @return/*w w w . j a v a 2s.c om*/ */ @Bean public CustomizableTraceInterceptor customizableTraceInterceptor() { CustomizableTraceInterceptor customizableTraceInterceptor = new CustomizableTraceInterceptor(); customizableTraceInterceptor.setUseDynamicLogger(true); customizableTraceInterceptor.setEnterMessage("Entering $[methodName]($[arguments])"); customizableTraceInterceptor.setExitMessage("Leaving $[methodName](), returned $[returnValue]"); return customizableTraceInterceptor; }
From source file:br.com.teste.spring.security.config.AppConfig.java
@Bean public CustomizableTraceInterceptor interceptor() { CustomizableTraceInterceptor interceptor = new CustomizableTraceInterceptor(); interceptor.setEnterMessage(ENTER_METHOD_MESSAGE); interceptor.setExceptionMessage(EXCEPTION_MESSAGE); interceptor.setExitMessage(EXIT_METHOD_MESSAGE); return interceptor; }
From source file:org.springframework.aop.interceptor.CustomizableTraceInterceptorTests.java
@Test public void testSunnyDayPathLogsCorrectlyWithPrettyMuchAllPlaceholdersMatching() throws Throwable { MethodInvocation methodInvocation = mock(MethodInvocation.class); given(methodInvocation.getMethod()).willReturn(String.class.getMethod("toString", new Class[0])); given(methodInvocation.getThis()).willReturn(this); given(methodInvocation.getArguments()).willReturn(new Object[] { "$ One \\$", new Long(2) }); given(methodInvocation.proceed()).willReturn("Hello!"); Log log = mock(Log.class); given(log.isTraceEnabled()).willReturn(true); CustomizableTraceInterceptor interceptor = new StubCustomizableTraceInterceptor(log); interceptor.setEnterMessage(new StringBuffer().append("Entering the '") .append(CustomizableTraceInterceptor.PLACEHOLDER_METHOD_NAME).append("' method of the [") .append(CustomizableTraceInterceptor.PLACEHOLDER_TARGET_CLASS_NAME) .append("] class with the following args (") .append(CustomizableTraceInterceptor.PLACEHOLDER_ARGUMENTS).append(") and arg types (") .append(CustomizableTraceInterceptor.PLACEHOLDER_ARGUMENT_TYPES).append(").").toString()); interceptor.setExitMessage(new StringBuffer().append("Exiting the '") .append(CustomizableTraceInterceptor.PLACEHOLDER_METHOD_NAME).append("' method of the [") .append(CustomizableTraceInterceptor.PLACEHOLDER_TARGET_CLASS_SHORT_NAME) .append("] class with the following args (") .append(CustomizableTraceInterceptor.PLACEHOLDER_ARGUMENTS).append(") and arg types (") .append(CustomizableTraceInterceptor.PLACEHOLDER_ARGUMENT_TYPES).append("), returning '") .append(CustomizableTraceInterceptor.PLACEHOLDER_RETURN_VALUE).append("' and taking '") .append(CustomizableTraceInterceptor.PLACEHOLDER_INVOCATION_TIME).append("' this long.") .toString());/* ww w .j a v a 2s . co m*/ interceptor.invoke(methodInvocation); verify(log, times(2)).trace(anyString()); }