title: Logging Error Spring boot Gradle
body: <p>I am getting the following error when i trying to user loggin in my application</p>
  
  <pre><code>    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
          at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
          at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
  Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.apache.logging.slf4j.Log4jLoggerFactory loaded from jar:file:/home/dev/code/my_proj/build/libs/proj-core-0.1.0.jar!/BOOT-INF/lib/log4j-slf4j-impl-2.6.2.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.apache.logging.slf4j.Log4jLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext
          at org.springframework.util.Assert.isInstanceOf(Assert.java:346)
          at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartedEvent(LoggingApplicationListener.java:226)
          at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:205)
          at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:62)
          at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:48)
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
          at com.abc.def.Application.main(Application.java:22)
          ... 8 more
  </code></pre>
  
  <p>This is my logback.xml</p>
  
  <pre><code>&lt;configuration&gt;
  
      &lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt;
  
          &lt;encoder&gt;
              &lt;pattern&gt;%date{YYYY-MM-dd HH:mm:ss} [%.7thread] %level %logger{10}:%line %mdc%n %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
  
  
      &lt;/appender&gt;
  
      &lt;logger name="com.abc" level="debug"
              additivity="false"&gt;
          &lt;appender-ref ref="STDOUT"/&gt;
      &lt;/logger&gt;
      &lt;root level="ERROR"&gt;
          &lt;appender-ref ref="STDOUT"/&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This is my dependencies in build.gradle</p>
  
  <pre><code>dependencies {
      compile("org.springframework.boot:spring-boot-starter-data-mongodb")
      compile ('org.springframework.boot:spring-boot-starter-web'){
          exclude module: 'org.springframework.boot:spring-boot-starter-logging'
      }
      compile ('org.springframework.boot:spring-boot-starter-log4j2')
      compile("org.springframework.boot:spring-boot-starter-actuator")
      compile("org.springframework.boot:spring-boot-starter-mail")
      compile("org.springframework.boot:spring-boot-starter-amqp")
      testCompile("org.springframework.boot:spring-boot-starter-test")
      compile group: 'org.springframework', name: 'spring-context-support'
  
      compile 'org.codehaus.groovy:groovy'
  }
  </code></pre>
  
  <p>I am using them as below.</p>
  
  <pre><code>import org.apache.log4j.Logger;
  @Service
  public class MyService {
    Logger logger = Logger.getLogger(MyService.class.getName());
  </code></pre>
  
  <p>My application is not even starting
  I tried google search but its very confusing as I am new to Gradle and logging. Please help.</p>