In Grails 1 and 2, there is a DSL log that is configured and used in the finished web application, so you 'I need to remove the log4j = { ... } code from grails-app/conf/Config.groovy
If you want to use an external configuration file for logging, as in a typical Java web application, update the grails-app/conf/spring/resources.groovy file as follows.
beans = { log4jConfigurer(org.springframework.beans.factory.config.MethodInvokingFactoryBean) { targetClass = "org.springframework.util.Log4jConfigurer" targetMethod = "initLogging" arguments = ["classpath:log4j.properties"] } }
Note that the package name used in your Log4j application configuration will probably not be what you expect, since it will add a special Grails prefix ...
WARN grails.app.controllers.org.example.BookController - This is a warn log message from BookController ERROR grails.app.controllers.org.example.BookController - This is an error log message from BookController
Drew
source share