Tomcat - 将在DEBUG级别记录更多出现的HTTP头解析错误

时间:2018-03-09 09:44:07

标签: java spring spring-boot logging tomcat8

我创建了一个SpringBoot应用程序。当我发出HTTP Post请求时,标头大小很大,我收到以下错误:

2018-03-09 14:53:01,190 INFO  [http-nio-8080-exec-1] logging.DirectJDKLog (DirectJDKLog.java:182) - Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Request header is too large
at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:706) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.http11.Http11InputBuffer.parseHeader(Http11InputBuffer.java:853) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.http11.Http11InputBuffer.parseHeaders(Http11InputBuffer.java:565) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:703) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.27.jar:8.5.27]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_101]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_101]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.27.jar:8.5.27]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101]

请注意,将在DEBUG级别记录更多出现的HTTP标头解析错误(如错误说明中所述)。我想解决这个问题,以便在INFO级别本身记录所有出现的此类错误。

所以,我在application.properties文件中添加了这两行(位于src / main / resources / config /):

org.apache.juli.logging.UserDataHelper.CONFIG = INFO_ALL
org.apache.juli.logging.UserDataHelper.SUPPRESSION_TIME = 0
# server.maxHttpHeaderSize=10000000

但这不起作用(只有在INFO级别记录第一次出现错误)。

请注意,设置maxHttpHeaderSize = 10000000工作正常,它会使大头问题完全消失。

但我想要的是 - 所有这些错误都记录在INFO级别本身。

任何帮助将不胜感激:)

其他信息:SpringBoot版本:1.5.10.RELEASE, Tomcat版本:8.5.27

0 个答案:

没有答案