欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

grails中log4j.properties配置

程序员文章站 2022-03-24 13:36:00
...
首先是:grails-app/conf/spring/resources.groovy
beans = {
    log4jConfigurer(org.springframework.beans.factory.config.MethodInvokingFactoryBean) {
        targetClass = "org.springframework.util.Log4jConfigurer"
        targetMethod = "initLogging"
        arguments = ["classpath:config/log4j.properties"]
    }
}

然后properties配置文件
# This custom log4j.properties file is a workaround for problem with logging when
# deployed to Tomcat. This goes hand-in-hand with src/templates/war/web.xml
# Taken from /home/firstuser/dev/tools/grails-1.1.1/src/war/WEB-INF/log4j.properties (ralam - jan 6, 2010)
log4j.rootLogger=DEBUG, stdout, logfile

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n

log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=/var/log/bigbluebutton/bbb-web.log
log4j.appender.logfile.MaxFileSize=1MB
# Keep three backup files.
log4j.appender.logfile.MaxBackupIndex=3
# Pattern to output: date priority [category] - message
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n


log4j.logger.org.codehaus.groovy.grails.web.servlet=WARN
log4j.logger.org.codehaus.groovy.grails.web.pages=WARN
log4j.logger.org.codehaus.groovy.grails.web.sitemesh=WARN
log4j.logger.org.codehaus.groovy.grails.web.mapping.filter=WARN
log4j.logger.org.codehaus.groovy.grails.web.mapping=WARN
log4j.logger.org.codehaus.groovy.grails.web.binding=WARN
log4j.logger.org.codehaus.groovy.grails.commons=WARN
log4j.logger.org.codehaus.groovy.grails.plugins=WARN
log4j.logger.org.codehaus.groovy.grails.orm.hibernate=WARN
log4j.logger.org.codehaus.groovy.grails.context.support=WARN

# Spring
log4j.logger.org.springframework=WARN

# Hibernate
log4j.logger.org.hibernate=WARN

# Mortbay
log4j.logger.org.mortbay.log=WARN

# ActiveMQ
log4j.logger.org.apache.activemq=WARN

# JSecurity
log4j.logger.org.jsecurity=WARN

# BigBlueButton
log4j.logger.org.bigbluebutton=DEBUG
log4j.logger.grails.app.controller=DEBUG
log4j.logger.grails.app.service=DEBUG