How to View Live Tomcat Logs/Output On Linux?

When you run tomcat on linux with startup.sh shell script, unlike windows console, you won’t see complete logs. You will only see this

Tomcat_startup_logsBut , almost every time, you will be required to see the logs. Tomcat saves its logs in a file “catalina.out” under tomcat_installation_dir/logs directory. ThereĀ are two ways that you can view logs

  1. Just got to your tomcat installation directory and then go into logs directory
    # cd /tomcat_installation_dir/logs

    Then issue the following command to view the logs

    # vi catalina.out

    You can view the logs now, but they are not live. If they are changed you have to get out of editor and open the logs again

  2. Second way is more convenient and its live. Again make sur your are in the tomcat logs directory and issue the following command
    #tail -f catalina.out

    Now see the tomcat runtime logs. Example

tomcat_logs_on_linux

Published by

Ali

Some day I'll fill this up. Till then Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo ....

4 thoughts on “How to View Live Tomcat Logs/Output On Linux?”

  1. dont use vi on log files, vi is design for editing files, not viewing.
    you should use:
    less catalina.out

    then press:
    shift – g

    This means goto end of file. Repeatedly pressing shift g, will reload more data from the file, so you dont need to go in and out of the file.

  2. Thanks. This information was very helpful. What is the command to get out of the catalina.out file? What are the commands(linux shortcut) to scroll up and down a page?

    1. @Nidhi Press Ctrl+C or Ctrl+z and if you in vi then press :q to quit the file. Moreover, read the first comment by Tim which is quite useful

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>