如何从 grails log4j 附加程序中排除包

发布于 2024-10-10 00:34:06 字数 441 浏览 0 评论 0原文

我在 Config.groovy 中配置了一个附加程序,如下所示:

all myLog:['grails.app.controller', 'grails.app.service', 'grails.app.domain', 'grails.app.task'], additivity: false

现在上述包中有一个我不想记录的特殊包,例如 grails.app.service.some。服务。

如何从 myLog Appender 中排除此包?我已经找到这个 StackOverflow 问题和答案,但我没有知道如何将其“翻译”到我的 grails 配置中。

I have an appender configured in Config.groovy like this:

all myLog:['grails.app.controller', 'grails.app.service', 'grails.app.domain', 'grails.app.task'], additivity: false

Now there is a special package inside the above packages which I don't want to log, e.g. grails.app.service.some.service.

How can I exclude this package from the myLog Appender? I already found this StackOverflow question and answer, but I don't know how to "translate" this into my grails configuration.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哽咽笑 2024-10-17 00:34:06

我通常在 Grails 中以不同的方式定义日志级别,例如:

  info 'com.opensymphony.oscache'
  warn 'org.codehaus.groovy.grails.web.servlet',  //  controllers
       'org.codehaus.groovy.grails.web.pages' //  GSP
  error 'groovyx.net.http.ParserRegistry'
  debug 'org.jgroups.protocols.pbcast.GMS'

要禁用特定包甚至类中的日志,我会这样做:

  off 'com.example.excluded.package'

这样做的好处是,您可以完全控制每个包甚至每个包的日志级别如果需要的话可以上课。

希望这有帮助!

I usually define the log level in Grails differently, something like:

  info 'com.opensymphony.oscache'
  warn 'org.codehaus.groovy.grails.web.servlet',  //  controllers
       'org.codehaus.groovy.grails.web.pages' //  GSP
  error 'groovyx.net.http.ParserRegistry'
  debug 'org.jgroups.protocols.pbcast.GMS'

And to disable the log in a specific package or even a class I do:

  off 'com.example.excluded.package'

The good thing about this is that you can have full control of the log level per package or even per class if necessary.

Hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文