Groovy&Grails-代碼剪輯-日誌跟蹤

任何開發都須要跟蹤一些調試信息,避免頻繁的使用Debug模式,咱們會在方法中放入一些info,執行過程當中打印到後臺,Grails使用的是log4j做爲日誌框架,因此和在Java開發中的使用方法是同樣的,這裏在config中將經常使用的幾個設置記錄一下,備拷node

<!-- lang: groovy -->
// 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'

    // Set level for all application artifacts
    info "grails.app"
    // Set for a specific controller in the default package
    //debug "grails.app.controllers.YourController"

    // Set for a specific domain class
    //debug "grails.app.domain.org.example.Book"

    // Set for all taglibs
    //info "grails.app.taglib"
}

更詳細的內容能夠參考Grails1.2參考文檔速讀(3)web

相關文章
相關標籤/搜索