On the CABI JasperServer machine, the tomcat localhost* log files are growing very large and can fill up the hard disk quickly.
Every day a large log file localhost-aaaa-mm-dd.log is created, and filled with these type of messages:
14-Oct-2022 23:57:23.676 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet [jsp] threw exception
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:3091)
at org.apache.catalina.connector.Request.getSession(Request.java:2509)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:896)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:231)
at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:596)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:231)
at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:596)
--snip--
14-Oct-2022 23:57:23.676 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jasperserver] in context with path [/jasperserver-pro] threw exception [org.apache.jasper.JasperException: org.apache.tiles.request.render.CannotRenderException: java.io.IOException: JspException when evaluating the body] with root cause
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:3091)
at org.apache.catalina.connector.Request.getSession(Request.java:2509)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:896)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:231)
at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:596)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:231)
at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:596)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:231)
--snip--
14-Oct-2022 23:58:26.449 SEVERE [http-nio-8080-exec-5] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet [jsp] threw exception
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:3091)
at org.apache.catalina.connector.Request.getSession(Request.java:2509)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:896)
Spectrum 22.2.x
CABI Jasper 7.9.1 (SP2) on LINUX.
These messages in the logs are benign. However, tomcat isn't automatically cleaning up these large files being created.
Root cause of the messages is unclear.
As a workaround, to limit the creation of localhost-aaaa-mm-dd.log files and prevent the disk filling up the following steps can be followed.
Add the maxDays = parameter to the configuration files logging.properties and server.xml and specify the number of days the logs should be retained. The log files older than the number of days set in this parameter will be deleted.
For example, to limit the creation of localhost-aaaa-mm-dd.log files to 30 days, add maxDays = 30
1. Make a backup of "/<CABI>/apache-tomcat/conf/logging.properties".
2. Add the maxDays param to "/<CABI>/apache-tomcat/conf/logging.properties"
2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8
2localhost.org.apache.juli.AsyncFileHandler.maxDays = 30
3. Make a backup of "/<CABI>/apache-tomcat/conf/server.xml";
4. Add the maxDays attribute to the <Valve/> section in "/<CABI>/apache-tomcat/conf/server.xml";
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt" maxDays="30"/>
5. Restart the CABI server using the stop/start scripts.
The changes done to the configuration files will not be retained after a CABI upgrade.
Always do a backup of the modified files and then add the changes back after the upgrade.
Refer to the CABI documentation section "Back up the Configuration Files":