title: Spring Boot Logger Aspects
body: <p>I'm having problems getting my logging aspect to log information when methods from classes of a particular package are accessed.  In other words, "no" logging occurs.  I even got desperate and added System.out.println statements, with no luck.</p>
  
  <p>All of my classes are located under the <strong>org.my.package</strong> package, i.e. <strong>org.my.package.controller</strong>, <strong>org.my.package.model</strong>, etc.</p>
  
  <p>Here is my Application class:</p>
  
  <pre><code>package org.my.package;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.EnableAspectJAutoProxy;
  
  @Configuration
  @ComponentScan(basePackages = {"org.my.package.config"})
  @EnableAutoConfiguration
  @EnableAspectJAutoProxy
  public class FirstWebAppApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(FirstWebAppApplication.class, args);
      }
  }
  </code></pre>
  
  <p>This is my configuration class:</p>
  
  <pre><code>package org.my.package.config;
  
  import org.deloitte.javatraining.daythree.utilities.MyLogger;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.EnableAspectJAutoProxy;
  
  @Configuration
  @EnableAspectJAutoProxy
  @ComponentScan(basePackages = {"org.my.package.utilities"})
  public class AssetConfig {
  
      //-----------------------------------------------------------------------------------------------------------------------
      @Bean   
      public MyLogger myLogger(){
         return new MyLogger();
      }
  }
  </code></pre>
  
  <p>This is my Aspect class:</p>
  
  <pre><code>package org.my.package.utilities;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  import org.aspectj.lang.JoinPoint;
  import org.aspectj.lang.annotation.AfterReturning;
  import org.aspectj.lang.annotation.Aspect;
  import org.aspectj.lang.annotation.Before;
  import org.springframework.stereotype.Component;
  
  @Aspect
  @Component
  public class MyLogger {
  
      /** Handle to the log file */
      private final Log log = LogFactory.getLog(getClass());
  
      public MyLogger () {}
  
      @AfterReturning("execution(* org.my.package.*.*(..))")
      public void logMethodAccessAfter(JoinPoint joinPoint) {
          log.info("***** Completed: " + joinPoint.getSignature().getName() + " *****");
          System.out.println("***** Completed: " + joinPoint.getSignature().getName() + " *****");
      }
  
      @Before("execution(* org.my.package.*.*(..))")
      public void logMethodAccessBefore(JoinPoint joinPoint) {
          log.info("***** Starting: " + joinPoint.getSignature().getName() + " *****");
          System.out.println("***** Starting: " + joinPoint.getSignature().getName() + " *****");
      }
  }
  </code></pre>
  
  <p>These are my Gradle build dependencies:</p>
  
  <pre><code>dependencies {
      compile("org.springframework.boot:spring-boot-starter-data-jpa")
      compile("org.springframework.boot:spring-boot-starter-web")
      compile('com.h2database:h2:1.3.156')
      compile('javax.servlet:jstl:1.2')
      compile('org.springframework.boot:spring-boot-starter-aop')
      providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper")
      testCompile("org.springframework.boot:spring-boot-starter-test") 
  }
  </code></pre>
  
  <p>Am I missing something or otherwise mis-configuring my Aspect class?  I can't find anything wrong, after verifying with other, similar Stack Overflow questions and online tutorials.</p>
  
  <p>Please advise.</p>