0

log4j = {

appenders {
   'null' name:'stacktrace'
   environments {
        development {               
            rollingFile name: "appLog",
                        maxFileSize:'102400kB',
                        file: "./logs/tempAppLog.log",
                        layout:pattern(conversionPattern: '%d{[EEE, dd-MMM-yyyy @ HH:mm:ss.SSS]} [%t] %-5p %c %x - %m%n')
            root {
                debug 'appLog'
            }
        }
    }
}

error 'grails.app.service' //Service
error 'grails.app.controller' //  controllers
error 'com.demoapp'

info 'grails.app.service'
info 'grails.app.controller'
info 'com.demoapp'

debug 'grails.app.service'
debug 'grails.app.controller'
debug 'com.demoapp'

}

  • 这里使用上述配置,它会在 tempAppLog.log 中写入大量调试日志,这些日志都没有用。我只想要我的包级调试日志。我正在使用 grails 2.2.1 版本。

请帮助我避免将未使用的日志写入文件,仅应将特定于包的日志写入文件。

谢谢。

4

1 回答 1

0

改变

   root {
            debug 'appLog'
        }

   root {
            error 'appLog'
        }

可能会帮助你

于 2017-01-07T08:44:52.050 回答