tags:

views:

69

answers:

1

Using the default config of a fresh Grails project, how do i change it so that ONLY error level messages will go to 'Message' table?

// log4j configuration
log4j = {
    // Example of changing the log pattern for the default console
    // appender:
    //
    //appenders {
    //    console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
    //}


    error  'org.codehaus.groovy.grails.web.servlet',  //  controllers
               'org.codehaus.groovy.grails.web.pages', //  GSP
               'org.codehaus.groovy.grails.web.sitemesh', //  layouts
               'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
               'org.codehaus.groovy.grails.web.mapping', // URL mapping
               'org.codehaus.groovy.grails.commons', // core / classloading
               'org.codehaus.groovy.grails.plugins', // plugins
               'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
               'org.springframework',
               'org.hibernate',
           'net.sf.ehcache.hibernate'

    warn   'org.mortbay.log'
}

Thanks for any leads on this.

A: 

You'll want to make a new appender that does the inserts, then register it at the error level.

For example,

appenders {
    appender new MyCustomAppender(name: "myCustom")
}
error myCustom: 'org.whatever'
John Stoneham