I have installed Tomcat 7 on an Amazon EC2 running Amazon Linux. I have installed a WAR file on tomcat and I am using java.util.logging for logging messages in my code. Now how to access those log messages in Amazon EC2?
Asked
Active
Viewed 3.4k times
12
Gaurav Agarwal
- 921
- 5
- 17
- 30
1 Answers
13
The standard location for Tomcat log files is:
/var/log/tomcat
David Levesque
- 529
- 5
- 8
-
There is folder tomcat7 at the location you suggested but I cannot `cd` into it. How do I access log file? – Gaurav Agarwal Jul 03 '12 at 19:46
-
2Try to su as root user first: `su -`, or use sudo before your commands, e.g.: `sudo ls -al /var/log/tomcat7` to see the directory content. – David Levesque Jul 03 '12 at 19:55
-
Thanks, it worked. If I may ask which file will have `Log.log()` from my Servlets. – Gaurav Agarwal Jul 03 '12 at 20:16
-
2I would look in `catalina.out` first or one of the files starting with `localhost`. If you still don't find it, you can sort the files by date using `ls -ltr` to see the ones recently modified. – David Levesque Jul 03 '12 at 20:20
-
I have asked a related question here http://superuser.com/questions/444572/how-can-i-copy-my-tomcat-catalina-out-files-from-amazon-ec2-to-my-local-machine – Gaurav Agarwal Jul 03 '12 at 20:34
-
Thank you this is helpful. In my case the application logs localhost.2019-07-19.log.For doing su - I had to create root user(using command: sudo adduser
) for EC2 as I did not had one and helped me to access files that had permission denied prompt – tadtab Jul 19 '19 at 08:13