My Magento site is down and I see
main.CRITICAL: Cannot write to the "/var/www/html/var/debug/db.log" file. Unable to write {"exception":"[object] (Magento\Framework\Exception\FileSystemException(code: 0): Cannot write to the \"/var/www/html/var/debug/db.log\" file. Unable to write at /var/www/html/vendor/magento/framework/Filesystem/File/Write.php:54)"} []
I tried php bin/magento setup:di:compile
but I get
Command line user does not have read and write permissions on generated directory. Please address this issue before using Magento command line.
I tried changing the permission of generated directory by sudo chmod 0777 -R generated
but still no success. Any advice would be great help.
Update : These are the owners of var/log and generated directory
/var/www/html# ls -la var/log generated
generated:
total 16
drwxrwsrwx 3 ubuntu www-data 4096 Apr 6 06:29 .
drwxr-xr-x 22 ubuntu www-data 4096 Apr 6 08:42 ..
-rwxrwxrwx 1 ubuntu www-data 126 Jan 19 20:01 .htaccess
drwxrwsrwx 2 ubuntu www-data 4096 Apr 6 10:43 code
var/log:
total 436820
drwxrwsr-x 3 ubuntu www-data 4096 Mar 17 05:58 .
drwxrwsr-x 12 ubuntu www-data 4096 Apr 6 07:56 ..
-rw-rw-r-- 1 ubuntu www-data 7180 Feb 2 13:55 4-1549115600.log
-rw-rw-r-- 1 ubuntu www-data 409 Feb 3 11:27 Amasty-inventory-19-02-03.log
-rw-rw-r-- 1 ubuntu www-data 1352583 Apr 3 14:00 cache-warmer.log
-rw-rw-r-- 1 ubuntu www-data 793265 Apr 3 14:45 connector.log
-rw-rw-r-- 1 ubuntu www-data 405626880 Apr 6 10:51 debug.log
-rw-rw-r-- 1 ubuntu www-data 8498179 Apr 6 06:23 exception.log
drwxrwsr-x 2 ubuntu www-data 4096 Feb 24 13:49 firebear
-rw-rw-r-- 1 ubuntu www-data 483328 Apr 6 10:51 magento.cron.log
-rw-rw-r-- 1 ubuntu www-data 36864 Apr 6 10:51 setup.cron.log
-rw-rw-r-- 1 ubuntu www-data 0 Feb 10 13:19 shippingaddress_process.log
-rw-rw-r-- 1 ubuntu www-data 30228480 Apr 6 10:51 system.log
-rw-rw-r-- 1 ubuntu www-data 0 Feb 2 09:39 update.cron.log
-rw-rw-r-- 1 ubuntu www-data 870 Mar 19 10:15 update.log