I am using slf4j \"DailyRollingFileAppender\" in grails 2.3.4.
When i tried to use a variable as part of the \"file\" parameter, the grails always print some error logs
Use Holders to read config properties. I assume it will not be able to read the config property itself while setting up log4j
as it is part of the config itself.
import grails.util.Holders
...
log4j = {
// Example of changing the log pattern for the default console appender:
appenders {
console name: 'stdout', layout: pattern(conversionPattern: '%c{2} %m%n')
appender new DailyRollingFileAppender(
name: "userEventLog",
file: "${Holders.config.event.log.dir}/user-event.log",
layout: pattern(conversionPattern: '%m%n'),
datePattern: "'.'yyyy_MM_dd",
threshold: org.apache.log4j.Level.INFO
)
}
info userEventLog: "app.bean.log.UserEventLog"
}