Mon, 10 Apr 06

JSVC and large log files

Posted in Programming, Tomcat at 8:42 am by moore | Permalink

jsvc, which is used for daemoning Tomcat and other java applications on unix, takes filenames for stdout and stderr as arguments. One thing to be aware of is that when the either of these files reach a size of just over 2 gigabytes, jsvc simply fails. No error message. If you restart the application, it will note that it can’t write to the file and proceeds to write to the console. I saw this behavior using tomcat 5 on fedora core 4 with jsvc 1.0.1 (described here).

I am not sure exactly what the problem is, but when I started tomcat via the normal shell script, it was able to write to that file. The user that jsvc runs as had no limits on file size:

-bash-3.00$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 1024
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 32764
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Therefore, it might be an issue with jsvc. Do note that there are nightly snapshots of jsvc, which might solve the issue. The solution I found is to use the copytruncate option of logrotate.

2 Comments »

  1. Gabe said,

    November 22, 2009 at 5:05 pm

    Hi, another solution would be to use a named pipe to redirect to a logging solution such as logrotate. I describe how here: http://gabenell.blogspot.com/2009/11/working-around-jsvcs-logging.html

  2. moore said,

    November 29, 2009 at 3:59 pm

    Great solution, Gabe! Thanks for pointing out that named pipes can be another way to deal with JSVC’s limits.

    What version of JSVC were you using?

Leave a Comment


© Moore Consulting, 2003-2010