How to redirect Tomcat logs back to catalina.out instead of syslog?
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.
Related videos on Youtube
no id
Updated on September 18, 2022Comments
-
no id over 1 year
In the release notes for
openSUSE 13.1
, developers proudly stated thatTomcat
logs are no longer being written intocatalina.out
, but rather written tosyslog
. 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,- My Tomcat installation is used as a playground for several developers, and I hardly want to share my syslog with them.
- 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"
-
S edwards about 10 yearswhat is your tomcat config ? (not oblige to put every virtual host)
-
S edwards about 10 yearsdoes the catalina.sh still present ?
-
no id about 10 yearsYes, it's present. I have found some acceptable solution. I will publish it in a couple of minutes.
-
Phil about 9 yearsAny idea how to do this for syslog-ng?