title: Grails 2.x loggers conflict (slf4j, log4j and commons-logging)
body: <p>After upgrading existing app from Grails 1.3.7 to Grails 2.0.4 (tried 2.0.3 also) I got some kind of <code>slf4j</code> and <code>log4j</code> conflict. Seems that </p>
  
  <ul>
  <li>log4j tries to write to using commons-logging</li>
  <li>commons-logging write to slf4j</li>
  <li>but slf4j logger appender uses log4j</li>
  </ul>
  
  <p>Circular reference. And <code>java.lang.StackOverflowError</code> as a result.</p>
  
  <pre><code>java.lang.StackOverflowError
      at org.apache.log4j.PatternLayout.format(PatternLayout.java:500)
      at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
      at org.apache.log4j.Category.callAppenders(Category.java:206)
      at org.apache.log4j.Category.forcedLog(Category.java:391)
      at org.apache.log4j.Category.log(Category.java:856)
      at org.slf4j.impl.GrailsLog4jLoggerAdapter.logMessage(GrailsLog4jLoggerAdapter.java:191)
      at org.slf4j.impl.GrailsLog4jLoggerAdapter.error(GrailsLog4jLoggerAdapter.java:166)
      at org.apache.commons.logging.impl.SLF4JLog.error(SLF4JLog.java:213)
      at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
      at org.apache.log4j.Category.callAppenders(Category.java:206)
      at org.apache.log4j.Category.forcedLog(Category.java:391)
      at org.apache.log4j.Category.log(Category.java:856)
      at org.slf4j.impl.GrailsLog4jLoggerAdapter.logMessage(GrailsLog4jLoggerAdapter.java:191)
      at org.slf4j.impl.GrailsLog4jLoggerAdapter.error(GrailsLog4jLoggerAdapter.java:166)
      at org.apache.commons.logging.impl.SLF4JLog.error(SLF4JLog.java:213)
      at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
      at org.apache.log4j.Category.callAppenders(Category.java:206)
      at org.apache.log4j.Category.forcedLog(Category.java:391)
      at org.apache.log4j.Category.log(Category.java:856)
      at org.slf4j.impl.GrailsLog4jLoggerAdapter.logMessage(GrailsLog4jLoggerAdapter.java:191)
      at org.slf4j.impl.GrailsLog4jLoggerAdapter.error(GrailsLog4jLoggerAdapter.java:166)
      ...
  </code></pre>
  
  <p>Seems that log4j logs to commons-logging, commons-loggin</p>
  
  <p>I tried to exclude log4j from dependencies, and use <code>log4j-over-slf4j</code> as a replaicement but some Grails classes have direct Log4J usage:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org/apache/log4j/LogManager
      at org.slf4j.impl.GrailsSlf4jLoggerFactory.getLogger(GrailsSlf4jLoggerFactory.java:43)
      at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:253)
      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)
  </code></pre>
  
  <p>And I can't exclude slf4j, because it's used by standard Grails plugins, like Resources plugin.</p>
  
  <p>Btw, I never had such situation before, with other Grails 2.0.3 projects. Seems that it's something with configuration or dependencies specific only for current application, but I can't find anything unusual. </p>
  
  <p>Anyone had same issue?</p>