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 run startup.sh
with?
Asked
Active
Viewed 6.1k times
46
-
1You need to do `./catalina.sh run`. If you view usage of catalina.sh you will see `run -> Start Catalina in the current window`. – Aniket Thakur Nov 05 '14 at 16:56
-
Isn't it possible to move this question to https://serverfault.com/?. – Jaime Hablutzel Jan 24 '19 at 19:22
-
1For 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 with `tomcat8` package installed). – Jaime Hablutzel Jan 24 '19 at 19:23
-
what about 'sudo -u tomcat /usr/libexec/tomcat/server start' for tomcat9 ? – f_s Jan 23 '23 at 10:40
2 Answers
101
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.

Olaf Kock
- 46,930
- 8
- 59
- 90
-
interesting, it mirrors Java's `Thread.start()` vs `Thread.run()` which I also used to confuse. – Sridhar Sarnobat Aug 20 '19 at 18:51
3
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

vels4j
- 11,208
- 5
- 38
- 63