Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are logs located?

I'm debugging a JSON endpoint and need to view internal server errors. However, my app/storage/logs dir is empty and it seems there are no other directories dedicated to logs in the project. I've tried googling the subject to no avail.

How can I enable logging, if it's not already enabled and view the logs?

like image 927
Alex Lomia Avatar asked May 31 '16 00:05

Alex Lomia


People also ask

Where are logs found?

In short /var/log is the location where you should find all Linux logs file. However, some applications such as httpd have a directory within /var/log/ for their own log files. You can rotate log file using logrotate software and monitor logs files using logwatch software.

Where should log files be stored?

The "standard" place for the log would be the AppData directory. However, really its up to you where you want to store them. As they are administrator (power users) then there should be no problems storing the logs in the same directory as the application being run.

Where are logs stored in Linux?

Linux System Logs Linux has a special directory for storing logs called /var/log . This directory contains logs from the OS itself, services, and various applications running on the system.


2 Answers

  • Ensure debug mode is on - either add APP_DEBUG=true to .env file or set an environment variable

  • Log files are in storage/logs folder. laravel.log is the default filename. If there is a permission issue with the log folder, Laravel just halts. So if your endpoint generally works - permissions are not an issue.

  • In case your calls don't even reach Laravel or aren't caused by code issues - check web server's log files (check your Apache/nginx config files to see the paths).

  • If you use PHP-FPM, check its log files as well (you can see the path to log file in PHP-FPM pool config).

like image 54
Denis Mysenko Avatar answered Sep 28 '22 14:09

Denis Mysenko


You should be checking the root directory and not the app directory.

Look in $ROOT/storage/laravel.log not app/storage/laravel.log, where root is the top directory of the project.

like image 33
Ali Avatar answered Sep 28 '22 13:09

Ali