日志位于哪里? [英] Where are logs located?
问题描述
我正在调试JSON端点,需要查看内部服务器错误.但是,我的app/storage/logs
目录为空,并且似乎没有其他目录专用于项目中的日志.我尝试搜索该主题无济于事.
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?
推荐答案
-
确保打开调试模式-将
APP_DEBUG=true
添加到.env文件或设置环境变量Ensure debug mode is on - either add
APP_DEBUG=true
to .env file or set an environment variable日志文件位于storage/logs文件夹中.
laravel.log
是默认文件名.如果日志文件夹存在权限问题,Laravel会暂停.因此,如果您的端点正常工作-权限就不成问题了.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.如果您的呼叫甚至没有到达Laravel或不是由代码问题引起的,请检查Web服务器的日志文件(检查您的Apache/nginx配置文件以查看路径).
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).
如果您使用PHP-FPM,请同时检查其日志文件(您可以在PHP-FPM池配置中查看日志文件的路径).
If you use PHP-FPM, check its log files as well (you can see the path to log file in PHP-FPM pool config).
这篇关于日志位于哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!