title: Unable to use logback.groovy, but logback.xml works
body: <p>I wanted to configure Logback using Groovy DSL. The file is very simple:</p>
  
  <pre><code>import ch.qos.logback.classic.encoder.PatternLayoutEncoder
  import ch.qos.logback.core.ConsoleAppender
  import static ch.qos.logback.classic.Level.DEBUG
  import static ch.qos.logback.classic.Level.INFO
  
  appender("stdout", ConsoleAppender) {
      encoder(PatternLayoutEncoder) {
          pattern = "%d %p [%c] - &lt;%m&gt;%n"
      }
  }
  
  root(INFO, ["stdout"])
  </code></pre>
  
  <p>I use Gradle to build my application and run it with jettyRun. I get the following error:</p>
  
  <pre><code>Failed to instantiate [ch.qos.logback.classic.LoggerContext]
  Reported exception:
  org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'ch.qos.logback.core.ConsoleAppender[null]' with class 'ch.qos.logback.core.ConsoleAppender' to class 'ch.qos.logback.core.Appender'
      at  org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
  at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
  at ch.qos.logback.classic.gaffer.ConfigurationDelegate.appender(ConfigurationDelegate.groovy:119)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
  at org.codehaus.groovy.runtime.metaclass.MixinInstanceMetaMethod.invoke(MixinInstanceMetaMethod.java:53)
  at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:308)
  at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
  </code></pre>
  
  <p>However, when I switch to equivalent XML configuration, everything works. What am I doing wrong?</p>
  
  <p>Using Logback 1.0.0. Tried with Logback 1.0.3.</p>