title: Grails 2.1.1 - Logback integration
body: <p>I'm developing with Grails 2.1.1 and now I want to integrate Logback (http://logback.qos.ch) as the default logging framework as it should provide some better logging features and could be also configured via Groovy.</p>
  
  <p>As Logback 1.0.7 (latest) does only work with <code>slf4j 1.6.6</code> I want to upgrade the Grails dependeny. Grails 2.1.1 is using <code>slf4j 1.6.2</code>. How to do this properly?</p>
  
  <p>I tried the following: in <code>BuildConfig.groovy</code> I exclude <code>grails-plugin-log4j</code> and <code>slf4j-api</code></p>
  
  <pre><code>grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        excludes "grails-plugin-log4j", "slf4j-api"
    }
    ...
  }
  </code></pre>
  
  <p>and I try to load <code>slf4j-api 1.6.6</code> in <code>compile</code> <code>build</code> and <code>runtime</code> along with the other necessary libraries</p>
  
  <pre><code>grails.project.dependency.resolution = {
    ...
    dependencies {
      // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
  
      compile "org.slf4j:slf4j-api:1.6.6"
  
      build   "org.slf4j:slf4j-api:1.6.6",
              "ch.qos.logback:logback-core:1.0.7",
              "ch.qos.logback:logback-classic:1.0.7"
  
      runtime "org.slf4j:slf4j-api:1.6.6",
              "org.slf4j:log4j-over-slf4j:1.6.6", // logback dependency for classic module, as seen on http://logback.qos.ch/dependencies.html
              "ch.qos.logback:logback-core:1.0.7",
              "ch.qos.logback:logback-classic:1.0.7"
  }
    ...
  }
  </code></pre>
  
  <p>now, if I want to do anything from the Grails commandline, either <code>grails compile</code> or <code>grails clean</code>, it's complaining that it couldn't execute the script because it couldn't find the LoggerFactory class:</p>
  
  <pre><code>| Loading Grails 2.1.1
  | Configuring classpath
  | Error Error executing script Compile: org/slf4j/LoggerFactory (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
  java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
  at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
  at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
  at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
  at org.springframework.core.io.support.PathMatchingResourcePatternResolver.&lt;clinit&gt;(PathMatchingResourcePatternResolver.java:169)
  | Error Error executing script Compile: org/slf4j/LoggerFactory
  </code></pre>
  
  <p>How can I upgrade the underlying <code>slf4j-api</code> properly?</p>
  
  <p>If I don't exclude the <code>slf4j-api</code> first, I get a conflict with the "old" 1.6.2 api marked as evicted when calling <code>grails dependency-report</code>...</p>
  
  <p>Also, I'd love to have an external config file for Logback. How would I implement it? With Log4j I just declared a <code>log4jConfigurer</code> bean within the <code>conf/spring/resources.groovy</code> file - how would it be done with Logback?</p>
  
  <p>Has anybody experience in logging Grails 2.1.1 with Logback and could give me any advice for this issue?</p>