2

In the release notes for openSUSE 13.1, developers proudly stated that Tomcat logs are no longer being written into catalina.out, but rather written to syslog. I saw similar behaviour with new distributions, but now it's my problem also. I really don't know why it is considered as improvement. And that's why,

  1. My Tomcat installation is used as a playground for several developers, and I hardly want to share my syslog with them.
  2. The webapp under Tomcat is pretty verbose with logs (since it is under development) and I don't want to put all these garbage in to the syslog.

There are a plenty of tutorials on how to redirect Tomcat log into syslog, but I need to perform reverse operation. Any ideas?

UPD: Here is my tomcat.conf, nothing suspicious there:

JAVA_HOME="/etc/alternatives/jre"

CATALINA_HOME="/usr/share/tomcat" CATALINA_BASE="/usr/share/tomcat" CATALINA_TMPDIR="/var/cache/tomcat/temp"

SECURITY_MANAGER="false"

SHUTDOWN_WAIT="30"

SHUTDOWN_VERBOSE="false"

CLEAR_WORK="false"

CATALINA_OPTS="-Xms2G -Xmx8G -XX:PermSize=256m -XX:MaxPermSize=4G"

3
  • what is your tomcat config ? (not oblige to put every virtual host)
    – Kiwy
    Mar 25 '14 at 9:33
  • does the catalina.sh still present ?
    – Kiwy
    Mar 25 '14 at 21:46
  • Yes, it's present. I have found some acceptable solution. I will publish it in a couple of minutes.
    – no id
    Mar 25 '14 at 22:12
1

Tomcat being installed from openSUSE repo runs as a service under systemd. According to this page, it is not possible to redirect output of systemd-controlled services directly to the file. Thus, I have the only option left: filter messages from syslog when they got there.

I have created file /etc/rsyslog.d/tomcat.conf and put these lines there:

:programname,contains,"tomcat" /var/log/tomcat/tomcat.log

:programname,contains,"tomcat" ~

This works fine for me.

UPD 2018: Nowdays every developer would rather have own Tomcat instance unpacked into a folder, not installed system wide. Or even one embedded into the program, that could be done in Spring Boot for example.

1
  • Any idea how to do this for syslog-ng?
    – Phil
    Mar 8 '15 at 6:07

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.