How to start Tomcat with output on console in Linux?
58,312
Solution 1
You're looking for
tomcat/bin/catalina.sh run
instead of
tomcat/bin/startup.sh; tail -f tomcat/logs/catalina.out
Tomcat stays in foreground this way (first option). If you want to shut it down, Ctrl-C in your console window will do the trick.
If you choose the second option, tomcat will run in background, while tail will run in foreground, but you'll have to give the same directory path twice.
Solution 2
Instead of using service, cd
to Tomcat's bin directory, type ./startup.sh
. This will start Tomcat in console.
All the logs that goes to catalina.out you can modify it by this link : Tomcat logging
Related videos on Youtube
Author by
Igorock
Updated on July 09, 2022Comments
-
Igorock almost 2 years
I know it's possible to start tomcat and then run
tail -f catalina.out
to view Tomcat output. But how to run tomcat and view output at once? Are there some options to runstartup.sh
with?-
Aniket Thakur over 9 yearsYou need to do
./catalina.sh run
. If you view usage of catalina.sh you will seerun -> Start Catalina in the current window
. -
Jaime Hablutzel over 5 yearsIsn't it possible to move this question to serverfault.com?.
-
Jaime Hablutzel over 5 yearsFor Linux distributions where
catalina.sh
is not available after installing Tomcat from a package, something like the following could work:sudo -u tomcat /usr/libexec/tomcat/server start
(tested in Amazon Linux 2 withtomcat8
package installed).
-
-
Sridhar Sarnobat almost 5 yearsinteresting, it mirrors Java's
Thread.start()
vsThread.run()
which I also used to confuse.