我正在运行一个Jboss服务器,其中包括一个JAX-RS Web服务(使用与Jboss / EAP捆绑的resteasy-2.3.6.Final).
原文链接:https://www.f2er.com/ajax/160092.html当客户端中止对服务器的调用时,Resteasy SynchronousDispatcher可以(显然)不会将响应发送回客户端,这会导致在[SEVERE]和[ERROR]级别的一系列错误显示在我的服务器日志中.
但是,我不认为这些是实际的错误,所以我不想看到它们.特别是一旦这项服务公开使用,这一定会经常发生.
这是我要抑制的日志输出:
12:50:38,938 SEVERE [org.jboss.resteasy.core.SynchronousDispatcher] (http-localhost/127.0.0.1:8080-2) Failed executing GET /ajax/findPerson: org.jboss.resteasy.spi.WriterException: ClientAbortException: java.net.SocketException: Broken pipe at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:262) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] .... Caused by: ClientAbortException: java.net.SocketException: Broken pipe at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:403) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:356) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:426) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:415) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] ... Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) [rt.jar:1.7.0_51] at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) [rt.jar:1.7.0_51] at java.net.SocketOutputStream.write(SocketOutputStream.java:159) [rt.jar:1.7.0_51] at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:711) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:450) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:351) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] ... 12:50:38,942 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myapplication].[MyAjaxApplication]] (http-localhost/127.0.0.1:8080-2) JBWEB000236: Servlet.service() for servlet MyAjaxApplication threw exception: java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:392) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:152) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] ...
有没有一个优雅的方法呢?
通过writing my own ExceptionMapper我设法防止了第一个(SEVERE),并将其转换为调试级别的单行日志输出,但第二个仍然存在.坦白说,我不知道哪里甚至开始寻找.
我在另一个SO问题中看到I could just set the log level for one or both classes that throw the errors to a higher level,说[FATAL],但我会考虑这个更多的解决方法…
想法?