Return to Snippet

Revision: 55689
at February 17, 2012 08:57 by traneHead


Initial Code
environments {

  development {
    log4j = {
      appenders {
        file name: 'grailsfile', file: 'target/grails.log'
        file name: 'rootlog', file: 'target/root.log'
        file name: 'devfile', file: 'target/development.log',
          layout: pattern(conversionPattern: "[%d{HH:mm:ss:SSS}] %-5p %c{2}: %m%n")
      }
      root { error 'stdout', 'rootlog' }
      info additivity: false, grailsfile: 'org.codehaus.groovy.grails.commons'
      all additivity: false, devfile: [
        'grails.app.controllers.your.package',
        'grails.app.domain.your.package',
        'grails.app.services.your.package',
        'grails.app.taglib.your.package',
        'grails.app.conf.your.package',
        'grails.app.filters.your.package'
      ]
      }
  }

  test {
    log4j = {
      appenders {
        file name: 'grailsfile', file: 'target/grails.log'
        file name: 'rootlog', file: 'target/root.log'
        file name: 'testfile', file: 'target/test.log',
          layout: pattern(conversionPattern: "[%d{HH:mm:ss:SSS}] %-5p %c{2}: %m%n")
      }
      root { error 'stdout', 'rootlog' }
      info additivity: false, grailsfile: 'org.codehaus.groovy.grails.commons'
      all additivity: false, testfile: [
        'grails.app.controllers.your.package',
        'grails.app.domain.your.package',
        'grails.app.services.your.package',
        'grails.app.taglib.your.package',
        'grails.app.conf.your.package',
        'grails.app.filters.your.package'
      ]

    }
  }
  production {
    grails.logging.jul.usebridge = false
    log4j = {
      root { error()
      }
      
      }
  }
}

Initial URL

                                

Initial Description
An example of a grails (2.x) log4j configuration (in grails-app/conf/Config.groovy).

Initial Title
Grails log4j for different environments - an example

Initial Tags

                                

Initial Language
Groovy