Following the instruction here: Laravel Lumen change log file name
I am still getting the following error on a server where I cannot write to /storage/logs
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/app/lumen-app/storage/logs/lumen.log" could not be opened: failed to open stream: Permission denied' in /home/app/lumen-app/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:97
Stack trace:
#0 /home/app/lumen-app/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
I have placed the following code in bootstrap/app.php
$app->configureMonologUsing(function(Monolog\Logger $monolog) use($logPath){
$handler = (new \Monolog\Handler\StreamHandler(storage_path($logPath)))
->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));
return $monolog->pushHandler($handler);
});
where $logPath = __DIR__.'/../../../logs/lumen-app.log';
for some reason its not picking this up.
Second note: i am receiving this error while running a artisan commnd. Within artisan command scripts - there are a lot of things in app that goes missing that are not available if the program booted normal. Is there another way to log this properly?