Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

log4j in grails : how to log into file?

I have this log4j configuration in my grails config.groovy

log4j = {
    error  'org.codehaus.groovy.grails.web.servlet',  //  controllers
                   'org.codehaus.groovy.grails.web.pages' //  GSP
    warn 'org.mortbay.log' 


    appenders {
        rollingFile  name:'infoLog', file:'info.log', threshold: org.apache.log4j.Level.INFO, maxFileSize:1024
        rollingFile  name:'warnLog', file:'warn.log', threshold: org.apache.log4j.Level.WARN, maxFileSize:1024
        rollingFile  name:'errorLog', file:'error.log', threshold: org.apache.log4j.Level.ERROR, maxFileSize:1024
        rollingFile  name:'custom', file:'custom.log', maxFileSize:1024
    }

    root {
        info 'infoLog','warnLog','errorLog','custom', stdout
        error()
        additivity = true
    }
}

the infoLog,warnLog and errorLog was from the previous question ... they were working well.

now I add new RollingFile wit name "custom" ...

I tried to log from my controller and service using log.info("something .... ${obj}"); but it seems that message was not inserted into custom.log, do I need to add something to the configuration ?

thank you !!

like image 825
nightingale2k1 Avatar asked Jul 21 '09 03:07

nightingale2k1


1 Answers

just got answer from the grails' mailing list:

i just need to add

debug "grails.app"

bellow warn "org.mortbay.log"

case closed ! :)

like image 61
nightingale2k1 Avatar answered Oct 11 '22 18:10

nightingale2k1