本文介绍了如何使LogbackValve异步支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Web应用程序中使用了logback-access.
I'm using logback-access in my web app.
但是当我在server.xml中使用< Valve className ="ch.qos.logback.access.tomcat.LogbackValve"/>
时.我的servlet使用request.startAsync()将失败.
But when I'm using <Valve className="ch.qos.logback.access.tomcat.LogbackValve"/>
in server.xml.My servlet using request.startAsync() will fail.
java.lang.IllegalStateException: Not supported.
at org.apache.catalina.connector.Request.startAsync(Request.java:1664)
at org.apache.catalina.connector.Request.startAsync(Request.java:1657)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1023)
at com.nut.NutServlet.doPost(NutServlet.java:61)
at com.nut.NutServlet.doGet(NutServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:172)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
这是因为ch.qos.logback.access.tomcat.LogbackValve不支持async.那么如何使它成为asyncSupported?
推荐答案
您只需要设置 asyncSupported ="true"
属性,即可在 server.xml中配置阀门代码>.
You just need to set the asyncSupported="true"
attribute where you configure the valve in server.xml
.
<Valve className="ch.qos.logback.access.tomcat.LogbackValve" asyncSupported="true"/>
这篇关于如何使LogbackValve异步支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!