title: Grails 2.1 disables log4j config on JBoss
body: <p>We recently upgraded our app from Grails 1.3.7 to 2.1, which builds under maven, and made a bunch of changes to the pom file and other config- and build-related files of grails to get things working.</p>
  
  <p><strong>Here's the issue:</strong> when our JBoss server deploys our grails war file, something appears to cause log4j to be reconfigured such that the appserver stops all logging from that  point forward (for any class). The app server is still running fine, but there is no logging after this line:</p>
  
  <pre><code>INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/our-app
  </code></pre>
  
  <p>Removing our war file and restarting the server shows things logging correctly.</p>
  
  <p>Our appserver has a <code>server/default/conf/jboss-log4j.xml</code> file in  where we specify our cross-app log4j config.</p>
  
  <p>I've tried removing log4j and slf4j jar files from our war, as that has caused issues in the past, but it hasn't solved the problem this time.</p>
  
  <p>I also commented out the entire <code>log4j</code> section of <code>grails-app/Config.groovy</code> thinking that might be the culprit, but that had no effect.</p>
  
  <p>I also tried removing the grails log4j plugin (by marking it as 'provided' scope in the pom), but that causes the following error during deployment:</p>
  
  <pre><code>ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/out-app]] (main) Error configuring application listener of class org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener
      java.lang.ClassNotFoundException: org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener
  </code></pre>
  
  <p><strong>Any idea what I might have missed?</strong></p>
  
  <p>An abbreviated listing of my war file is below:</p>
  
  <pre><code>WEB-INF/applicationContext.xml
  WEB-INF/classes/BootStrap.class
  WEB-INF/classes/BuildConfig.class
  WEB-INF/classes/Config.class
  WEB-INF/classes/DataSource.class
  WEB-INF/classes/HibernateGrailsPlugin.class
  WEB-INF/classes/UrlMappings.class
  WEB-INF/classes/application.properties
  WEB-INF/classes/gsp/views.properties
  WEB-INF/classes/resources.class
  WEB-INF/grails.xml
  WEB-INF/jboss-web.xml
  WEB-INF/lib/antlr-2.7.7.jar
  WEB-INF/lib/aopalliance-1.0.jar
  WEB-INF/lib/aspectjrt-1.6.10.jar
  WEB-INF/lib/aspectjweaver-1.6.10.jar
  WEB-INF/lib/cglib-2.2.jar
  WEB-INF/lib/commons-beanutils-1.8.3.jar
  WEB-INF/lib/commons-codec-1.5.jar
  WEB-INF/lib/commons-collections-3.2.1.jar
  WEB-INF/lib/commons-dbcp-1.4.jar
  WEB-INF/lib/commons-el-1.0.jar
  WEB-INF/lib/commons-fileupload-1.2.2.jar
  WEB-INF/lib/commons-io-2.0.1.jar
  WEB-INF/lib/commons-lang-2.6.jar
  WEB-INF/lib/commons-pool-1.5.6.jar
  WEB-INF/lib/commons-validator-1.3.1.jar
  WEB-INF/lib/concurrentlinkedhashmap-lru-1.2_jdk5.jar
  WEB-INF/lib/dom4j-1.6.1.jar
  WEB-INF/lib/ehcache-core-2.4.6.jar
  WEB-INF/lib/encryption-1.0.jar
  WEB-INF/lib/ezmorph-1.0.6.jar
  WEB-INF/lib/grails-bootstrap-2.1.0.jar
  WEB-INF/lib/grails-core-2.1.0.jar
  WEB-INF/lib/grails-crud-2.1.0.jar
  WEB-INF/lib/grails-datastore-core-1.0.9.RELEASE.jar
  WEB-INF/lib/grails-datastore-gorm-1.0.9.RELEASE.jar
  WEB-INF/lib/grails-datastore-simple-1.0.9.RELEASE.jar
  WEB-INF/lib/grails-hibernate-2.1.0.jar
  WEB-INF/lib/grails-logging-2.1.0.jar
  WEB-INF/lib/grails-plugin-codecs-2.1.0.jar
  WEB-INF/lib/grails-plugin-controllers-2.1.0.jar
  WEB-INF/lib/grails-plugin-converters-2.1.0.jar
  WEB-INF/lib/grails-plugin-datasource-2.1.0.jar
  WEB-INF/lib/grails-plugin-domain-class-2.1.0.jar
  WEB-INF/lib/grails-plugin-filters-2.1.0.jar
  WEB-INF/lib/grails-plugin-gsp-2.1.0.jar
  WEB-INF/lib/grails-plugin-i18n-2.1.0.jar
  WEB-INF/lib/grails-plugin-log4j-2.1.0.jar
  WEB-INF/lib/grails-plugin-mimetypes-2.1.0.jar
  WEB-INF/lib/grails-plugin-scaffolding-2.1.0.jar
  WEB-INF/lib/grails-plugin-services-2.1.0.jar
  WEB-INF/lib/grails-plugin-servlets-2.1.0.jar
  WEB-INF/lib/grails-plugin-url-mappings-2.1.0.jar
  WEB-INF/lib/grails-plugin-validation-2.1.0.jar
  WEB-INF/lib/grails-resources-2.1.0.jar
  WEB-INF/lib/grails-spring-2.1.0.jar
  WEB-INF/lib/grails-web-2.1.0.jar
  WEB-INF/lib/grails-webflow-2.1.0.jar
  WEB-INF/lib/groovy-all-1.8.6.jar
  WEB-INF/lib/hibernate-ehcache-3.6.10.Final.jar
  WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
  WEB-INF/lib/hibernate-validator-4.1.0.Final.jar
  WEB-INF/lib/http-builder-0.5.0-RC3.jar
  WEB-INF/lib/httpclient-4.0.jar
  WEB-INF/lib/httpcore-4.0.1.jar
  WEB-INF/lib/json-lib-2.3-jdk15.jar
  WEB-INF/lib/jstl-1.1.2.jar
  WEB-INF/lib/nekohtml-1.9.9.jar
  WEB-INF/lib/oro-2.0.8.jar
  WEB-INF/lib/sitemesh-2.4.jar
  WEB-INF/lib/spring-aop-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-asm-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-aspects-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-beans-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-context-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-context-support-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-core-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-expression-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-jdbc-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-jms-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-orm-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-tx-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-web-3.1.0.RELEASE.jar
  WEB-INF/lib/spring-webmvc-3.1.0.RELEASE.jar
  WEB-INF/lib/util-io-1.2-SNAPSHOT.jar
  WEB-INF/lib/utils-1.07.00.jar
  WEB-INF/lib/validation-api-1.0.0.GA.jar
  WEB-INF/lib/xml-resolver-1.2.jar
  WEB-INF/lib/xpp3_min-1.1.4c.jar
  WEB-INF/lib/zdecimal-3.2.jar
  WEB-INF/plugins/hibernate-2.1.0/grails-app/i18n/messages.properties
  WEB-INF/plugins/hibernate-2.1.0/plugin.xml
  WEB-INF/sitemesh.xml
  WEB-INF/web.xml
  </code></pre>
  
  <p>And Config.groovy (with app-specific stuff removed):</p>
  
  <pre><code>grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
  grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
  grails.mime.use.accept.header = false
  grails.mime.types = [
      all:           '*/*',
      atom:          'application/atom+xml',
      css:           'text/css',
      csv:           'text/csv',
      form:          'application/x-www-form-urlencoded',
      html:          ['text/html','application/xhtml+xml'],
      js:            'text/javascript',
      json:          ['application/json', 'text/json'],
      multipartForm: 'multipart/form-data',
      rss:           'application/rss+xml',
      text:          'text/plain',
      xml:           ['text/xml', 'application/xml']
  ]
  grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']
  grails.views.default.codec = "none" // none, html, base64
  grails.views.gsp.encoding = "UTF-8"
  grails.converters.encoding = "UTF-8"
  grails.views.gsp.sitemesh.preprocess = true
  grails.scaffolding.templates.domainSuffix = 'Instance'
  grails.json.legacy.builder = false
  grails.enable.native2ascii = true
  grails.logging.jul.usebridge = true
  grails.spring.bean.packages = []
  grails.hibernate.cache.queries = false
  environments {
      production {
          grails.logging.jul.usebridge = false
      }
      development {
          grails.logging.jul.usebridge = true
      }
      test {
          // shouldn't be using this environment
      }
  }
  </code></pre>