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

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 ....

More Posts

Follow Me:
TwitterFacebookLinkedInGoogle PlusFlickr

No related posts.

4 Comments

  • 1
    Tim
    August 10, 2012 - 9:05 pm | Permalink

    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
      Ali
      August 11, 2012 - 12:36 pm | Permalink

      That’s quite useful information. Thanks

  • 3
    Nidhi
    October 10, 2012 - 8:14 pm | Permalink

    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?

    • 4
      October 12, 2012 - 9:52 am | Permalink

      @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 *

    *

    Wrap your code in [sourcecode language="java"][/sourcecode] tag (you can replace "java" with language you are using).