Project: Tomcat
Bug 46907 Jasper with log4j in web-app classpath and debug level enabled prevents reading HTTP POST stream from JSP
Reported: 2009-03-24 15:20:17 | Status: resolved fixed

This is on Tomcat 5.5.x (don't remember the last rev. number, not my current machine). When log4j is in the classpath of the web-app and is configured to log at debug level, Jasper dumps the whole HTTP POST request body as debug traces. This consumes the HttpServletRequest input stream which then arrives unusable for the user at the beginning of the JSP code (using HttpServletRequest.getInputStream(), the stream is already at its end). A workaround is to disable debug traces for Japser class in log4j.properties, but Jasper should not consume the HttpServletRequest input stream whatever mode it runs into.

Files changed in fix:
java/org/apache/jasper/servlet/JspServlet.java