禁用Bean中的Exception日志记录 [英] Disable logging of Exception in Bean

查看:181
本文介绍了禁用Bean中的Exception日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Wildfly 10和JAX-RS(resteasy)并在另一个Bean中注入Bean:

I'm using Wildfly 10 and JAX-RS (resteasy) and have a Bean being injected in another Bean:

@Path("foo")
public class FooResource {
    @Inject
    BarBean bar;
    ...
}

然后我在<抛出RuntimeException的code> bar 。我在 FooResource 中处理此异常,但Wildfly有拦截器将堆栈跟踪打印到日志中。我不希望这种情况发生。有没有办法禁用这种行为?

Then I'm calling a method on bar that throws a RuntimeException. I'm handling this Exception in FooResource, but Wildfly has interceptors that print the stack trace to the log. I don't want this to happen. Is there any way to disable this behavior?

推荐答案

我只能在 @Inject <时重现这个/ code> ed bean是一个EJB(使用Wildfly-9)。

I could only reproduce this when the @Injected bean was a EJB (with Wildfly-9).

您可以通过Web界面禁用EJB异常日志记录(:9990)

You can disable EJB exception logging through the webinterface (:9990)

配置 - >子系统 - > EJB 3 - >日志系统异常
将此值设置为false,您不应再看到异常记录。

Configuration -> Subsystems -> EJB 3 -> Log system exceptions Put this value to false and you should not see exceptions logged anymore.

这篇关于禁用Bean中的Exception日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆