How to write root user to laravel daily log file?

I have a Laravel 5.4 project using laravel daily log format. (A daily log file is generated)

I also have a supervisor running an php artisan queue:work

artisan command and cannot write to the daily log file. This is because it is a user root

. However, the web server can write to the log file.

I tried the following commands:

sudo chmod -R gu+w storage
sudo chmod -R guo+w storage
sudo chown -R root:www-data app/storage

      

I found that the root user cannot write to the log file as it is generated like below:

-rw-r--r-- 1 www-data www-data 12325 May 12 01:30 laravel-2017-05-12.log

The format below will work, but I need to keep working sudo chmod -R 777 storage

, which is a security issue.

-rwxrwxrwx 1 ubuntu www-data 111254 May 11 20:55 laravel-2017-05-11.log

How can I solve this, anyone?

+3


source to share





All Articles