Home  >  Q&A  >  body text

Laravel stderr channel logging on Docker not working properly

I have a simple application using php Laravel and configured the following channels for logging:

'stderr' => [
            'driver' => 'monolog',
            'level' => env('LOG_LEVEL', 'debug'),
            'handler' => StreamHandler::class,
            'formatter' => env('LOG_STDERR_FORMATTER'),
            'with' => [
                'stream' => 'php://stderr',
            ],
        ],

I have ensured that the environment variables LOG_CHANNEL and LOG_LEVEL are configured correctly. Although docker doesn't output anything. Can anyone give me more feedback on how to debug this? Thank you so much

P粉450079266P粉450079266334 days ago448

reply all(1)I'll reply

  • P粉715274052

    P粉7152740522023-12-14 09:43:18

    I'm using this and everything works fine:

    'stderr' => [
                'driver' => 'monolog',
                'level' => env('LOG_LEVEL', 'debug'),
                'handler' => StreamHandler::class,
                'formatter' => env('LOG_STDERR_FORMATTER'),
                'with' => [
                    'stream' => 'php://stdout',
                    'level' => 'debug',
                ],
            ],

    Hope you find a solution!

    reply
    0
  • Cancelreply