skip to Main Content

Need Live Logs of tomcat and other things running on EC2 Server

Already added EC2 ip address and gave command

cd /usr/share/tomcat

but how to go further ?

2

Answers


  1. you would need to Navigate the PuTTY window to your logs. In most instances, you can use "cd ~/logs" or "/var/www/vhosts/example.com/statistics/logs/".
    Unix logs are stored in a variety of locations, so you’ll need to find the location of the error log before you can view them.

    then

    Enter the command to see your error logs. The command varies between servers and operating systems, but the default is similar to: "tail -n 10 error.log".
    If you get an error message or don’t receive an answer, your error logs might be in a different location. Check with your server’s information to find the file path your logs are stored.
    Some commands will require root access and should start with "sudo" to work.

    Login or Signup to reply.
  2. As I understand your question, you want to watch live logs printing on your terminal as soon as any logs are generated in the log files.
    So for this, you can use tail -f <filename> command to see live logs printing on the terminal.
    You just have to go to in directory where logs are stored/generated. Logs are generally stored at the following location.

    TOMCAT_DIR/logs/catalina.out

    Here TOMCAT_DIR is the directory where your apache-tomcat is deployed.
    For example, you have tomcat stored at /usr/share/tomcat this location, so just follow these commands :

    cd /usr/share/tomcat/logs/   # Changing the directory to /usr/share/tomcat
    tail -f catalina.out         # Print real-time date updating the file
    

    I hope this answers your question.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search