title: Performance Logging with Spring Boot and AOP
body: <p>I'm trying to implement performance logging based off of this post: <a href="http://www.baeldung.com/spring-performance-logging" rel="noreferrer">http://www.baeldung.com/spring-performance-logging</a>. I'd like to log each controller endpoint and every database request. If you would like to see the full project, you can find it <a href="https://github.com/ndrone/phonebook-example/tree/feature/aopPerfLog" rel="noreferrer">here</a>. When I hit the endpoints nothing is logged. Placing a breakpoint within the interceptor class it doesn't stop either. I've already set my logging for the packages to the trace level. What am I missing? I believe it's something to with the <code>@PointCut</code> but after looking at the docs I believe I have it correct. </p>
  
  <p><strong>Interceptor</strong></p>
  
  <pre><code>public class PerformanceMonitorInterceptor extends AbstractMonitoringInterceptor
  {
      @Override
      protected Object invokeUnderTrace(MethodInvocation methodInvocation, Log log) throws Throwable
      {
          String name = createInvocationTraceName(methodInvocation);
          StopWatch stopWatch = new StopWatch();
          stopWatch.start();
          log.trace(String.format("Method %s execution start at %s", name, LocalDateTime.now()));
  
          try
          {
              return methodInvocation.proceed();
          }
          finally
          {
              stopWatch.stop();
              log.trace(String.format("Method %s execution took %dms (%s)", name,
                  stopWatch.getTotalTimeMillis(), DurationFormatUtils
                      .formatDurationWords(stopWatch.getTotalTimeMillis(), true, true)));
          }
      }
  }
  </code></pre>
  
  <p><strong>Configuration</strong></p>
  
  <pre><code>@Configuration
  @EnableAspectJAutoProxy
  @Aspect
  public class ContactControllerPerfLogConfig
  {
      @Bean
      public PerformanceMonitorInterceptor performanceMonitorInterceptor()
      {
          return new PerformanceMonitorInterceptor();
      }
  
      // Any public method on the ContactController
      @Pointcut("execution(public * org.example.phonebookexample.app.contact.ContactController.*(..))")
      public void contactControllerMonitor()
      {
      }
  
      @Bean
      public Advisor contactControllerMonitorAdvisor(
          PerformanceMonitorInterceptor performanceMonitorInterceptor)
      {
          AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
          pointcut.setExpression("org.example.phonebookexample.app.contact.ContactControllerPerfLogConfig.contactControllerMonitor()");
          return new DefaultPointcutAdvisor(pointcut, performanceMonitorInterceptor);
      }
  }
  </code></pre>