Search code examples
grailsgroovylogback-groovy

Logback groovy configuration not working in production


I'm trying to log all STDOUT in a production environment using logback and grails 3

this is my configuration in logback.groovy:

if (Environment.PRODUCTION) {
    appender("STDOUT", FileAppender) {
        file = "/home/alfresco/log/stdout.log"
        append = true
        encoder(PatternLayoutEncoder) {
            pattern = "%level %logger - %msg%n"
        }
    }
    logger("grails.app", ERROR, ['STDOUT'], false)
}

it creates the file but no log is going into the file, what is wrong with my configuration?


Solution

  • Think you're missing setting the level of the logger e.g.

    root( INFO, ['STDOUT'] )