| Version 28 (modified by , 7 years ago) ( diff ) |
|---|
Logging in MySQL and Tomcat
To develop this multi-tier application, it is very important for you to understand what's happening in each tier. Whenever you have the question "why doesn't my application work?", the first thing you should do is to use the logging of MySQL and Tomcat to understand what each tier has received, and whether there is any error. This page provides instructions on how to enable and analyze logging of MySQL and Tomcat, on both the development machine and the production/AWS machine.
1. Tomcat Logging (AWS)
- Monitor log files by running the command:
sudo tail -f HOME_OF_TOMCAT/logs/*For instance:sudo tail -f /home/ubuntu/tomcat/logs/*
2. Tomcat Logging (Dev machine + Eclipse)
- After Eclipse starts, go to the Servers view and double-click the Tomcat server you're running.
- You will find a window like the image below. Then, click on the blue link: Open launch configuration.
- You will find a dialog window like the image below.
- Click on Arguments section. Log files are stored in the folder
logsof the path-Dcatalina.base.
- Change the directory to that folder and monitor the files to see how they change as your browser sends requests to Tomcat. In a Linux-like environment (e.g., Ubuntu or MacOS), you can run the following command :
tail -f *.
3. MySQL Logging (AWS)
- For MySQL (version > 5.6), to enable logging, uncomment the following line in
/etc/mysql/mysql.conf.d/mysqld.cnf:
#general_log_file = /var/log/mysql/mysql.log #general_log = 1
- After making the above changes, you must run the following command to apply changes:
sudo service mysql restart.
- Monitor log files by running:
sudo tail -f /var/log/mysql/mysql.log
4. MySQL Logging (Dev Machine)
- Change the corresponding MySQL configuration file as we do for AWS on your development machine
- Restart MySQL server on your development machine to apply the changes.
- Monitor the corresponding log files.
Attachments (3)
- launch-configuration.png (89.0 KB ) - added by 7 years ago.
- server-overview.png (112.0 KB ) - added by 7 years ago.
- server-view.png (27.7 KB ) - added by 7 years ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.



