Changing Lumen error log path
Following the instruction here: [Laravel Lumen change log file name] (http://stackoverflow.com/questions/31099651/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($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.
For those who are wondering why the nasty $logPath, the project is deployed within a symlink structure called current (for versioning) and the "storage" area is in the path ~/logs/ which is 2 directory behind.
If someone can efficiently help write something cleaning that, would be appreciated too.
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?
Please or to participate in this conversation.