#1065440 tomcat10: /etc/cron.daily/tomcat10 breaks tomcat's own deletion of old access logs

#1065440#5
Date:
2024-03-04 19:12:56 UTC
From:
To:
Dear Maintainer,

The tomcat10 package installs file '/etc/cron.daily/tomcat10' that encrypts
"old" logs in the '/var/log/tomcat10' directory. The problem is that this cron
jobs breaks the new mechanism that tomcat10 uses for deleting its own old log
files. In particular adding the option 'maxDays="2" in section  <Valve
className="org.apache.catalina.valves.AccessLogValve" directory="logs"
 ... in file /var/lib/tomcat10/conf/server.xml does not work.

I respectfully suggest that the new mechanisms that tomcat10 includes for
managing its own logs mean that we should remove "/etc/cron.daily/tomcat10"
from the package.

Thank you.

#1065440#10
Date:
2026-05-15 02:24:31 UTC
From:
To:
I can confirm I've also been impacted by a similar issue.  The issue
concerns the script /etc/cron.daily/tomcat10 will try to rotate files
that are empty and have never been written to.

Specifically:
find /var/log/$NAME/ -name \*.$EXT -daystart -mtime +0 -print0 -maxdepth 1 \
  | xargs --no-run-if-empty -0 gzip -9 EXT=$EXT.gz

Adding a -size parameter, even a small one, could fix this:
find /var/log/$NAME/ -name \*.$EXT -daystart -mtime +0 -size +10c
-print0 -maxdepth 1 \

Because of how tomcat uses <TimeBasedTriggeringPolicy> a file may
never rotate until an event is triggered.  This means the script may
try to compress the same rarely used application.log file over and
over again even if <TimeBasedTriggeringPolicy interval="1"
modulate="true"/> is defined.

This will trigger an error when gzip refuses to overwrite an existing file.

/etc/cron.daily/tomcat10:
gzip: /var/log/tomcat10/application.log.gz already exists;    not overwritten