问题
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;
...
}
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?
回答1:
I could only reproduce this when the @Inject
ed bean was a EJB (with Wildfly-9).
You can disable EJB exception logging through the webinterface (:9990)
Configuration -> Subsystems -> EJB 3 -> Log system exceptions Put this value to false and you should not see exceptions logged anymore.
来源:https://stackoverflow.com/questions/39656572/disable-logging-of-exception-in-bean