grails:在环境级别设置日志阈值?

时间:2011-11-08 23:32:10

标签: grails groovy log4j

所以我在Config.groovy中使用Grails log appender,如下所示:

console name: 'stdout',
  threshold: org.apache.log4j.Level.FATAL

appender new org.apache.log4j.DailyRollingFileAppender(name: "full",
  threshold: org.apache.log4j.Level.ERROR,
  file: "/tmp/test.log" );

我有这样的环境配置:

environments {
  root {
    info 'full', 'stdout'
    additivity=true
  }
  development {
  }
}

如何在开发环境中更改阈值?

2 个答案:

答案 0 :(得分:1)

environments {
  root {
    info 'full', 'stdout'
    additivity=true
  }
  development {
     appender new org.apache.log4j.DailyRollingFileAppender(name: "test",
       threshold: org.apache.log4j.Level.DEBUG,
       file: "/tmp/test.log" );
  }
}

答案 1 :(得分:1)

root {
    additivity=true
}
environments {
    development {
        info 'full', 'stdout'
    } 
    stage {
        info 'full', 'stdout'
    }
    production {
        error 'full', 'stdout'
    }
}