Intermittently log4j throws a nullpointexception when starting up our Grails app. From the stacktrace, we can see that setLevelAndAppender(Level level, Object[] appenders) is called with a null appender array. Walking up the stacktrace we can see the error occurs when the root closure is invoked.
I have tried cleaning the project, multiple refresh dependencies, shutting down STS, tossing all the log files and making some cosmetic changes in config.groovy--none of which seem to work.
Here is the log4j setup in config. If someone can see an obvious mistake in it, could you let me know?
Code:// log4j configuration log4j = { error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages', // GSP 'org.codehaus.groovy.grails.web.sitemesh', // layouts 'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping 'org.codehaus.groovy.grails.web.mapping', // URL mapping 'org.codehaus.groovy.grails.commons', // core / classloading 'org.codehaus.groovy.grails.plugins', // plugins 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration 'org.springframework', 'org.hibernate', 'net.sf.ehcache.hibernate' warn 'org.mortbay.log' appenders { console name:'stdout', layout:pattern(conversionPattern: '%d{ISO8601} %-5p [%c{1}] - %m%n' ), threshold:org.apache.log4j.Level.DEBUG rollingFile name:'stacktrace', file:"${logDirectory}/${appName}_stacktrace.log".toString(), threshold: org.apache.log4j.Level.ERROR, maxFileSize:2048000 rollingFile name:'infoLog', file:"${logDirectory}/${appName}_info.log".toString(), threshold: org.apache.log4j.Level.INFO, maxFileSize:2048000 rollingFile name:'errorLog', file:"${logDirectory}/${appName}_error.log".toString(), threshold: org.apache.log4j.Level.ERROR, maxFileSize:2048000 rollingFile name:'custom', file:"${logDirectory}/${appName}_custom.log".toString(), maxFileSize:2048000 } root { info 'infoLog','warnLog','errorLog', 'stdout' debug stdout //error 'mail' error 'errorLog', stdout //warn stdout additivity = true } }


Reply With Quote
