21

On OpenBSD 5.2, the default installation of tomcat-7.0.29 seems to be logging all errors into both catalina.out and catalina.YYYY-MM-DD.log.

Cns# ll /var/tomcat/logs/catalina.*
-rw-r--r--  1 _tomcat  _tomcat      3067 Jan 16 20:47 /var/tomcat/logs/catalina.2013-01-16.log
-rw-r--r--  1 _tomcat  _tomcat   1313285 Jan 17 21:47 /var/tomcat/logs/catalina.2013-01-17.log
-rw-r--r--  1 _tomcat  _tomcat     19668 Jan 18 17:33 /var/tomcat/logs/catalina.2013-01-18.log
-rw-r--r--  1 _tomcat  _tomcat      2479 Jan 23 15:25 /var/tomcat/logs/catalina.2013-01-23.log
-rw-r--r--  1 _tomcat  _tomcat      1580 Jan 26 22:58 /var/tomcat/logs/catalina.2013-01-26.log
-rw-r--r--  1 _tomcat  _tomcat     48165 Jan 27 19:30 /var/tomcat/logs/catalina.2013-01-27.log
-rw-r--r--  1 _tomcat  _tomcat     34526 Jan 28 16:41 /var/tomcat/logs/catalina.2013-01-28.log
-rw-r--r--  1 _tomcat  _tomcat    141985 Jan 29 23:56 /var/tomcat/logs/catalina.2013-01-29.log
-rw-r--r--  1 _tomcat  _tomcat    123254 Jan 30 23:25 /var/tomcat/logs/catalina.2013-01-30.log
-rw-r--r--  1 _tomcat  _tomcat    145209 Jan 31 22:30 /var/tomcat/logs/catalina.2013-01-31.log
-rw-r--r--  1 _tomcat  _tomcat      2615 Feb  1 09:01 /var/tomcat/logs/catalina.2013-02-01.log
-rw-r--r--  1 _tomcat  _tomcat     10068 Feb  2 19:18 /var/tomcat/logs/catalina.2013-02-02.log
-rw-r--r--  1 _tomcat  _tomcat     50541 Feb  3 23:49 /var/tomcat/logs/catalina.2013-02-03.log
-rw-r--r--  1 _tomcat  _tomcat     17519 Feb  4 21:29 /var/tomcat/logs/catalina.2013-02-04.log
-rw-r--r--  1 _tomcat  _tomcat      1158 Feb  5 22:18 /var/tomcat/logs/catalina.2013-02-05.log
-rw-r--r--  1 _tomcat  _tomcat    179466 Feb  6 23:51 /var/tomcat/logs/catalina.2013-02-06.log
-rw-r--r--  1 _tomcat  _tomcat  14585534 Feb  7 14:15 /var/tomcat/logs/catalina.2013-02-07.log
-rw-r--r--  1 _tomcat  _tomcat  16680119 Feb  7 14:15 /var/tomcat/logs/catalina.out

(Note how the total files size of catalina.YYYY-MM-DD.log is about the same as catalina.out, and the logs do seem duplicated.)

Is there a way to make it log only into catalina.YYYY-MM-DD.log, and not into catalina.out?

  • I prefer to keep catalina.out and rotate it. I de-configure catalina.xxx.log as in the most general case it contains less messages (it ignores System.out and System.err; programmers sometimes use these in a hurry). – kubanczyk Nov 22 '16 at 16:50
  • 1
    @kubanczyk: How exactly did you de-configure catalina.xxx.log? – StackzOfZtuff Sep 11 '18 at 8:08
11

After reading some info at http://tomcat.apache.org/tomcat-7.0-doc/logging.html, it seems like commenting out or removing all mentions of java.util.logging.ConsoleHandler from /etc/tomcat/logging.properties should do the trick.

After that, somehow the file still gets opened up for writing by tomcat (as stdout and stderr), but it doesn't seem to be puffed up with anything anymore.

Cns# stat /var/tomcat/logs/catalina.out
1136 3949577 -rw-r--r-- 1 _tomcat _tomcat 15763648 16695929 "Feb  7 14:58:46 2013" "Feb  7 14:58:37 2013" "Feb  7 14:58:37 2013" 16384 32672 0 /var/tomcat/logs/catalina.out
Cns# fstat | fgrep -e USER -e 3949577
USER     CMD          PID   FD MOUNT        INUM MODE       R/W    SZ|DV
_tomcat  java        8994    1 /var      3949577 -rw-r--r--   w 16695929
_tomcat  java        8994    2 /var      3949577 -rw-r--r--   w 16695929
Cns#
0

There are two possible solutions supported by Tomcat wiki:

  • Prevent application to log on System.out or System.err using logging frameworks.
  • Suppress capture it by swallowOutput. Where does System.out go? First two steps of instruction how to do this.

additionally one remark about rolling it. How do I rotate catalina.out?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.