Oi Pessoal, bom dia.
Estou tentando obter os logs do Laravel através do stdout do meu Container PHP, mas quando eu simulo um erro dentro do Container via php artisan ele não é mostrado no stdout do container:
fernando@c64d676157c2:/var/www$ php artisan command5
Command "command5" is not defined.
fernando@c64d676157c2:/var/www$
O erro é escrito no log do Laravel:
fernando@c64d676157c2:/var/www$ tail storage/logs/laravel.log
"}
[2022-02-22 12:43:52] dev.ERROR: Command "command5" is not defined. {"exception":"[object] (Symfony\\Component\\Console\\Exception\\CommandNotFoundException(code: 0): Command \"command5\" is not defined. at /var/www/vendor/symfony/console/Application.php:644)
[stacktrace]
#0 /var/www/vendor/symfony/console/Application.php(228): Symfony\\Component\\Console\\Application->find('command5')
#1 /var/www/vendor/symfony/console/Application.php(140): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#2 /var/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#3 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#4 /var/www/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#5 {main}
"}
fernando@c64d676157c2:/var/www$
Mas o erro não é mostrado no stdout do Container PHP:
fernando@notebookdell-1487 /lab/treinamento/travellist-laravel-demo main docker logs -f travellist-app SIGINT(2) ↵ 10345 09:44:30
[22-Feb-2022 12:40:57] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[22-Feb-2022 12:40:57] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[22-Feb-2022 12:40:57] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[22-Feb-2022 12:40:57] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[22-Feb-2022 12:40:57] NOTICE: fpm is running, pid 1
[22-Feb-2022 12:40:57] NOTICE: ready to handle connections
Eu tentei diversas combinações de configurações do php.ini file, config/logging.php, LOG_CHANNEL do ".env", diversas opções de configuração do stack e muito mais.
Eu estou usando o PHP na versão 7.4.28. laravel/framework v7.11.0 Composer version 2.2.6
O projeto foi clonado do Github: https://github.com/do-community/travellist-laravel-demo
Todos os containers estão up e rodando conforme o esperado:
fernando@notebookdell-1487 /lab/treinamento/travellist-laravel-demo main docker container ls 10344 09:40:58
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c64d676157c2 travellist "docker-php-entrypoi…" 5 seconds ago Up 3 seconds 9000/tcp travellist-app
2995a82595f7 mysql:5.7 "docker-entrypoint.s…" 5 seconds ago Up 3 seconds 3306/tcp, 33060/tcp travellist-db
736ede87e337 nginx:alpine "/docker-entrypoint.…" 5 seconds ago Up 3 seconds 0.0.0.0:8000->80/tcp, :::8000->80/tcp travellist-nginx
fernando@notebookdell-1487 /lab/treinamento/travellist-laravel-demo main 10345 09:41:01
Como eu posso obter os logs do Laravel através do stdout do meu container no Docker?