tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steffen Heil" <>
Subject AW: Tomcat belches out megabytes of white space during log rotation
Date Wed, 26 Jan 2005 18:45:27 GMT

> I have this weird problem with an instance of tomcat 4.1.30 
> running on Windows Server 2003. Tomcat output (log messages) 
> is directed into CATALINA_HOME/logs/catalina.out. Every 4 
> hours a little log rotation script runs while tomcat is 
> active. It zips catalina.out into an archived logs folder and 
> then truncates it. All this seems to work ok and you end up 
> with a small 1KB file. 
> The problem is that the next log entry to catalina.out (from the next
> request) is preceded by around 9MB of white space! After 
> heaving this load it settles down and writes log messages 
> normally. Until the next rotation that is. Then the same 
> thing happens. At the first http request to the server after 
> catalina.out is trucated, boom, around 9 more MB of white 
> space is dumped into it. Not the exact same amount as before.
> Actually, the amount has been going on for several months and 
> the actual amount of white space spew has been increasing. It 
> started out around 4MB.

You simply may not modify files, which are in use by other processes.
In fact, you may not modify the log at all, while the jvm has an open handle
on it.

I assume, that the whitespace is the result of truncating the log file.
I assume there are as many spaces in the new log as characters in the old

Simple lesson: Don't do it.
Use another logging mechanism, which has build in rotation support.

I'd also assume the same problem to be present on linux.
It is not surprising that this does not work on windows, it is more
surprising that it works on linux.


View raw message