Grails Log4j DSL 配置中的 Log4j 过滤器 [英] Log4j filter in Grails Log4j DSL configuration
本文介绍了Grails Log4j DSL 配置中的 Log4j 过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在 Grails log4j DSL 配置?我需要在我的 Grails log4j 配置中定义这样的东西:
Is there a way to specify a log4j filter in Grails log4j DSL configuration? I need to define something like this in my Grails log4j config:
<filter class="org.apache.log4j.filter.ExpressionFilter">
<param name="expression" value="EXCEPTION ~= com.company.BackendNotAvailableException" />
<param name="acceptOnMatch" value="false"/>
</filter>
我使用 Grails 1.3.7.
I use Grails 1.3.7.
推荐答案
我通过向 Bootstrap.groovy 添加一个简短的初始化代码解决了这个问题
I have worked around this issue by adding a short init code to Bootstrap.groovy
Logger.rootLogger.allAppenders.each { appender ->
ExpressionFilter filter = new ExpressionFilter()
filter.expression = "EXCEPTION ~= org.springframework.security.authentication.*"
filter.acceptOnMatch = false
filter.activateOptions()
appender.addFilter(filter)
}
这篇关于Grails Log4j DSL 配置中的 Log4j 过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文