Whenever I deploy a production application that has an error with an externalized configuration I receive the following message in the Tomcat log:
log4j:WARN No appenders could be found for logger (org.codehaus.groovy.grails.commons.cfg.ConfigurationHelper)
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Apparently the externalized configuration is processed prior to log4j being initialized properly and therefore no appenders are available to accept the messages from ConfigurationHelper.
Is there a way to pre-initialize log4j to capture these messages before the standard Grails log4j initialization takes place?
I was finally able to enable pre-initialization logging by creating a file in
$CATALINA_BASE\lib\log4j.properties:This allowed initial messages to be logged to the console. In the default Tomcat configuration they will be logged to the
$CATALINA_BASE\logs\catalina.outfile.Grails initialization did override these initial settings with the settings from
Config.groovyor the external configuration file.My external configuration file had incorrect permissions and could not be loaded.