I'm using laravel 5.7 in a docker container. My goal is to write error-log directly to stderr instead of laravel.log
logging.php
<?php
return [
'default' => env('LOG_CHANNEL', 'stack'),
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['stderr'], //before it was stderr
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'error',
],
//...
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'level' => 'error',
'with' => [
'stream' => 'php://stderr',
],
],
//...
],
];
The log target itself is working - laravel.log is empty - but it seems like the log level is ignored. In the docker logs I get also the debug messages
docker-compose logs --tail=100 container
...
ESC[36mcontainer_1 |ESC[0m [2019-07-01 09:57:51] local.DEBUG: ...
...
If I just change channels
(stack
) from stderr
to single
the logs (but only error level) are appended correctly to laravel.log
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire