How to Start Tomcat with Output on Console in Linux

How to start Tomcat with output on console in Linux?

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.

How to start Tomcat in debug mode and print to console?

You should be able to view the log by using something like:

tail -f /var/log/tomcat6/catalina.out

(your system's path may vary.)

how to start the tomcat server in linux?

The command you have typed is /startup.sh, if you have to start a shell script you have to fire the command as shown below:

$ cd /home/mpatil/softwares/apache-tomcat-7.0.47/bin
$ sh startup.sh
or
$ ./startup.sh

Please try that, you also have to go to your tomcat's bin-folder (by using the cd-command) to execute this shell script. In your case this is /home/mpatil/softwares/apache-tomcat-7.0.47/bin.

console output for tomcat 8 server on linux

Using Deryck's technique, I found out that the log file was stored in /var/log/upstart/tomcat.log

Even though after the fact it seems like a reasonable place to find that file, I know that given my lack of experience I would have never found it without using find on the whole filesystem. Thanks Deryck, you're a live saver!

Unable to start or Stop Tomcat on Linux Server

I will really suggest to upgrade tomcat, if it is mandatory then someone has to take the risk of the implementation, with that said lets list how to validate tomcat properly.

  1. Review the tomcat 6 versions that you really need, this is the list of tomcat 6 releases, if you are force to use tomcat 6.x then try to use the latest release in this case I would recommend v.6.0.53
  2. Unzip the tomcat into your disk
  3. Make sure that you give the execution permission to the .sh scripts that are in bin folder. For example if you are located at the bin folder of tomcat apache-tomcat-6.0.53/bin$> then you can run chmod +x ./*.sh
  4. Make sure that JAVA_HOME is set
  5. In your bin folder run the startup.sh script like this ./startup.sh
  6. Check if tomcat is running with this command ps -ef | grep tomcat it will list the running process that are related to tomcat.
  7. Try to stop tomcat, in your bin folder run the shutdown script ./shutdow.sh
  8. Check if tomcat is running with this command ps -ef | grep tomcat, if you don't get listed the tomcat process then it is stopped successfully otherwise you can force the shutdown, using kill - 9 <process-number> so for example when you run ps -ef | grep tomcat

Sample output of ps-ef command

servername    4328     1  0 21:43 pts/1    00:00:07 /usr/var/jdk1.8.0_111/bin/java -Djava.util.logging.config.file=... tomcat
servername 4497 4117 0 22:07 pts/1 00:00:00 grep --color=auto tomcat

Then stop tomcat with this kill -9 4328 it is because 4328 is the process number that you get from the ps -ef output.

How access tomcat without port number?

If you need to access your tomcat server through the browser with a default port number then configure the connector to http default port number 80. Please see the following instructions:

  1. Go to apache-tomcat-6.0.53/conf folder
  2. Open server.xml file
  3. Go to Connector configuration, by default it look like this:

Default connector configuration

<Connector port="8080" protocol="HTTP/1.1" 
connectionTimeout="20000"
redirectPort="8443" />

  1. Change the port number to 80, like this:

Connector configuration with port number 80

<Connector port="80" protocol="HTTP/1.1" 
connectionTimeout="20000"
redirectPort="8443" />

  1. Restart tomcat. One observation here, only for linux. The first 1024 ports are restricted to root user, with this approach you can start tomcat only with root user. There is another solution for this with iptables, only in a case when you have to start tomcat without root user, see this post if you need to use port 80 and start tomcat without root user redirect-port-80-to-8080-and-make-it-work-on-local

How can I log Tomcat startup messages to a file?

Tomcat usually logs its output to either catalina.out or a file called localhost.<date>.log. Check in Tomcat's logs folder, what you're looking for is probably already there.

Mac OS. Apache Tomcat 8. Console window + catalina output + shutdown ctrl+c

To run tomcat in console you have to you have to use run command not start.

Do exec "/Users/user/apache-tomcat-8.5.4/bin/catalina.sh" run -config /Users/user/tomcat-web-config so the tomcat will run in the console so you can use Ctrl + C to stop the process.

OTOH

If you use the start command to start tomcat use stop to stop the server.



Related Topics



Leave a reply



Submit