When using Laravel from the CLI and WEB, usually you'll end up creating the log file from two different users, this can prevent your application from loading correctly in either side.
In order to resolve this you just have to edit the file:
bootstrap/app.php
And right before the end of the file where the line reads:
return $app;
Add this bit of code, adapting it to your needs:
$app->configureMonologUsing(function (Monolog\Logger $monolog) {
$filename = storage_path('/logs/laravel.log');
$handler = new Monolog\Handler\RotatingFileHandler($filename, 0, \Monolog\Logger::DEBUG, true, 0666);
$handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));
$monolog->pushHandler($handler);
});
There are many more options you can customize with it, but this bit only makes sure the log is created with permissions to enable reading and writing by both the CLI user and the WEB user, setting the file permissions to 0666
which is the same as -rw-rw-rw-
Hope you find it useful.
Thank you. You saved my day.