When I described my ongoing journey in building an Android app, I mentioned the use of a LAMP server. Throughout the different phases of app development, I’ve been able to identify bugs quite easily by monitoring an error log file.
As a brief note to myself, I’d like to share what I’ve uncovered during the process of building the app.
The log file:
The location of a LAMP server log can vary depending on the server architectures they employ. In my specific case, I found the log file here:
/var/log/apache2/error.log
The tail command:
Here’s the command I utilized to continuously monitor the error logs. Whenever my app failed to log in or insert data into the database, a new set of error logs would be updated on my terminal console, all thanks to this command.
$ tail -f /var/log/apache2/error.log
[Mon Sep 18 08:32:41.521692 2023] [php:notice] [pid 33761] [client 192.168.0.xx:xxxxx] SQL Query: SELECT * FROM users WHERE email = 'test1@email.com' AND password = '1b4f0e9851971998e732078544c96b36c3d01cedf7caa332359d6f1d83567014'
[Mon Sep 18 12:37:06.518363 2023] [php:notice] [pid 33763] [client 192.168.0..xx:xxxxx] SQL Query: SELECT * FROM users WHERE email = 'test@eemail.com' AND password = 'xxxxxxxxxx'