dumb question time -- Is tomcat actually starting up all the way when you
run with systemd? One of the things that I ran into with tomcat and systemd
was that the default service start timeout was not enough time for tomcat
to start. Also, I'm not starting tomcat by calling jsvc directly; I'm using
the daemon.sh script. Here's what one of my tomcat unit files looks like:

[Unit]
Description= CAS server (Tomcat)
After=syslog.target network-online.target

[Service]
Type=forking
User=tomcat
Group=tomcat
Environment=CATALINA_HOME=/var/local/tomcat/tomcat
Environment=CATALINA_BASE=/var/local/tomcat/cas
Environment=JAVA_HOME=/var/local/tomcat/java
ExecStart=/var/local/tomcat/tomcat/bin/daemon.sh start
ExecStop=/var/local/tomcat/tomcat/bin/daemon.sh stop
RemainAfterExit=yes
TimeoutSec=300
[Install]
WantedBy=multi-user.target

I also have a setenv.sh file in $CATALINA_BASE/bin with this (yes, it's a
little redundant):
export JAVA_HOME="/var/local/tomcat/java"
export CATALINA_HOME="/var/local/tomcat/tomcat"
export CATALINA_BASE="/var/local/tomcat/cas"
CATALINA_PID="$CATALINA_BASE/logs/tomcat.pid"
CATALINA_OPTS="-server -Xmx512m -Dlog4j2.formatMsgNoLookups=true"
SERVICE_START_WAIT_TIME=300

I always get a catalina-daemon.out file when starting this way.

On Thu, Aug 11, 2022 at 12:25 PM Paul Chauvet <chauv...@newpaltz.edu> wrote:

> Hi Chris,
>
> I honestly don't care if they are in catalina.out, /var/log/messages, or a
> file named 'awesomestuff.log' - I just know that things are MISSING.
>
> Let me be more specific - sorry if I'm not being clear here!
>
>
> Normal operation (running via systemd) - I get Tomcat startup/shutdown,
> and some other info in catalina-YYYY-MM-DD.log.  I don't get the debug
> information for opensaml.
>
> When I start via startup.sh directly - a lot more is being logged to
> catalina.out than anywhere else I have been able to find.
>
>
> I tried starting Tomcat without using systemd by just doing the following
> - but still no catalina.out.
> /opt/tomcat/latest/bin/jsvc \
>             -Dcatalina.home=${CATALINA_HOME} \
>             -Dcatalina.base=${CATALINA_BASE} \
>             -Djava.awt.headless=true \
>
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>
> -Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties \
>             -Dlog4j2.FormatMsgNoLookups=true \
>             -cp
> ${CATALINA_HOME}/bin/commons-daemon.jar:${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar
> \
>             -pidfile ${CATALINA_PID} \
>             -java-home ${JAVA_HOME} \
>             -user tomcat \
>             $CATALINA_OPTS \
>             org.apache.catalina.startup.Bootstrap
>
>
>
> I ended up temporarily just starting via startup.sh just long enough to
> get the error logs I was looking for into catalina.out - then started it up
> again normally.
>
>
> Sorry to bother everyone with this - but I appreciate your assistance!
>
>
> ________________________________
> From: Christopher Schultz <ch...@christopherschultz.net>
> Sent: Thursday, August 11, 2022 1:34 PM
> To: users@tomcat.apache.org <users@tomcat.apache.org>
> Subject: Re: Issue with catalina.out not being generated (RHEL 7.9, tomcat
> 9.0.63)
>
> CAUTION: Message from a non-New Paltz email server. Treat message, links,
> and attachments with extra caution.
>
>
> Paul,
>
> On 8/11/22 13:03, Paul Chauvet wrote:
> > Hi Noelette,
> >
> > Thanks for the reponse!
> >
> > It logs to catalina-YYYY-MM-DD.log, localhost.YY-MM-DD.log,
> localhost_access_log.YYYY-MM-DD.txt - but it doesn't use catalina.out.
> >
> > When I temporarily started Tomcat via startup.sh it did create
> catalina.out (and start logging the things that it wasn't logging into the
> other files, /var/log/messages, or the systemd journal).
> >
> > I'll see if I can get my setup (at least temporarily) working with
> startup.sh.
>
> OH... you might just be misunderstanding what's happening.
>
> When you use catalina.sh start (or startup.sh), that script just does this:
>
> java [stuff] > ${CATALINA_BASE}/logs/catalina.out 2>&1
>
> When you run with jsvc, it includes some built-in file-rotation and so
> catalina-[date].log is the same thing.
>
> Are you irritated that you can't read the logs, or are you irritated
> that the log file isn't specifically "catalina.out"?
>
> -chris
>
> > ________________________________
> > From: Noelette Stout <noelettest...@isu.edu>
> > Sent: Thursday, August 11, 2022 12:35 PM
> > To: Tomcat Users List <users@tomcat.apache.org>
> > Subject: Re: Issue with catalina.out not being generated (RHEL 7.9,
> tomcat 9.0.63)
> >
> > CAUTION: Message from a non-New Paltz email server. Treat message,
> links, and attachments with extra caution.
> >
> >
> > We use systemd with jsvc and our tomcat instances write to
> > $CATALINA_BASE/logs by default.
> >
> > On Thu, Aug 11, 2022 at 10:10 AM Paul Chauvet <chauv...@newpaltz.edu>
> wrote:
> >
> >> Hello all,
> >>
> >> I haven't been able to figure this out - but a catalina.out file is not
> >> being generated for me.  Sadly - I'm trying to troubleshoot an issue
> (with
> >> a vendor's saml implementation) which wants to write to that file (and
> >> doesn't seem to be writing what I need to catalina.YYYY-DD-MM.logs,
> >> /var/log/messages, or into the journal as seen by "journalctl
> >> --unit=tomcat.service").
> >>
> >>
> >> My environment:
> >>
> >>    *   RHEL 7.9 (though the same happens on my RHEL 8 hosts)
> >>    *   Tomcat 9.0.63 (installed from the .tar.gz download from
> >> https://tomcat.apache.org/download-90.cgi - not from the OS repository)
> >>    *   Using jsvc via a systemd startup script to start Tomcat (that
> script
> >> is at the bottom of this message).
> >>
> >> I've tried specifying CATALINA_OUT in setenv.sh, and in my systemd
> startup
> >> script.  I've temporarily disabled SELinux to see if that makes a
> >> difference.  Neither of those work.  What does work, though I would
> like to
> >> avoid it, is if I start Tomcat via ./startup.sh.  If I do that -
> >> catalina.out is generated but I'm not getting other settings I set in my
> >> systemd script (or having it tied to startup/shutdown of the OS).
> >>
> >> I don't know what I'm missing or doing wrong here, or if there's
> something
> >> about jsvc that is an issue here that I can't figure out.  I've been
> unable
> >> to find anything related to this (lots of posts about catalina.out
> related
> >> to operating system distributed versions of Tomcat that don't appear to
> >> apply).
> >>
> >> Any advice here would be greatly appreciated!
> >>
> >> My systemd startup script is below.
> >>
> >>
> >> [Unit]
> >> Description=Apache Tomcat Web Application Container
> >> After=syslog.target network.target
> >>
> >> [Service]
> >> Type=forking
> >> PIDFile=/var/run/tomcat.pid
> >> UMask=0007
> >>
> >> # Tomcat variables
> >> Environment='JAVA_HOME=/usr/lib/jvm/java-openjdk'
> >> Environment='CATALINA_PID=/var/run/tomcat.pid'
> >> Environment='CATALINA_HOME=/opt/tomcat/latest'
> >> Environment='CATALINA_BASE=/opt/tomcat/latest'
> >> Environment='CATALINA_OPTS=-Xms512M -Xmx2048M -XX:+UseParallelGC
> -server'
> >> Environment='CATALINA_OUT=/var/log/tomcat/catalina.out'
> >>
> >> # Needed to make use of Tomcat Native Library
> >> Environment='LD_LIBRARY_PATH=/opt/tomcat/latest/lib'
> >>
> >> ExecStart=/opt/tomcat/latest/bin/jsvc \
> >>              -Dcatalina.home=${CATALINA_HOME} \
> >>              -Dcatalina.base=${CATALINA_BASE} \
> >>              -Djava.awt.headless=true \
> >>
> >> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
> >>
> >>
> -Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties \
> >>              -Dlog4j2.FormatMsgNoLookups=true \
> >>              -cp
> >>
> ${CATALINA_HOME}/bin/commons-daemon.jar:${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar
> >> \
> >>              -pidfile ${CATALINA_PID} \
> >>              -java-home ${JAVA_HOME} \
> >>              -user tomcat \
> >>              $CATALINA_OPTS \
> >>              org.apache.catalina.startup.Bootstrap
> >>
> >> ExecStop=/opt/tomcat/latest/bin/jsvc \
> >>              -pidfile ${CATALINA_PID} \
> >>              -stop \
> >>              org.apache.catalina.startup.Bootstrap
> >>
> >> [Install]
> >> WantedBy=multi-user.target
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> Paul Chauvet, CISSP
> >>
> >> Information Security Officer
> >>
> >> State University of New York at New Paltz
> >>
> >> chauv...@newpaltz.edu
> >>
> >>
> >
> > --
> > Noelette Stout
> > ITS Enterprise Applications - Senior Application Administrator
> > Idaho State University
> > E-mail: stounoel "at" isu "dot" edu
> > Desk: 208-282-2554
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

-- 
Noelette Stout
ITS Enterprise Applications - Senior Application Administrator
Idaho State University
E-mail: stounoel "at" isu "dot" edu
Desk: 208-282-2554

Reply via email to