Reputation: 6802
I'm using the nixpacks template from coolify (https://coolify.io/docs/applications/laravel/) to build a docker image and run it. Everything works fine, except I do not see the error logs in the terminal / when running docker logs.
My log channel is stack
which is configured like
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'stdout', 'syslog'],
'ignore_exceptions' => false,
],
with
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'stdout' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stdout',
],
'level' => env('LOG_LEVEL', 'debug'),
],
LOG_LEVEL
is set to debug. Running the application outside a docker container (starting with php artisan:serve) makes the logs appear as expected.
I found several resources and explanations for this (https://forums.docker.com/t/cant-get-laravel-logs-through-stdout-of-docker-container/121495)
If I understand it correctly, the logs do not appear because docker only shows the logs of the process with PID 1 - this the the start.sh
in my case
The start.sh
contains
#!/bin/bash
# Transform the nginx configuration
node /assets/scripts/prestart.mjs /assets/nginx.template.conf /etc/nginx.conf
# Start supervisor
supervisord -c /etc/supervisord.conf -n
The explanations makes sense, as I do see the supervisor logs about worker statuses.
HOWEVER, I did not find any solution or what I could do to make my laravel logs appear. I only ever found an explanation why they dont.
Upvotes: 0
Views: 57