chore(config): setup production logging

- use stderr in addition to the daily logging channel so the laravel logs are passed to the container logs (docker logs)
- use the daily channel with local laravel.log to persist logs to disk for 10 days, ensuring a persistent copy even if the coolify container is removed/ updated
- rotate the logs in production every 10 days and only log warnings, to prevent an excessively large laravel.log file
- keep LOG_LEVEL=debug for the single channel as it will be used in development
This commit is contained in:
peaklabs-dev 2025-12-04 14:26:46 +01:00
parent 9a6d315292
commit 0114ffac3e
No known key found for this signature in database

View file

@ -53,7 +53,7 @@ return [
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'channels' => explode(',', (string) env('LOG_STACK', 'stderr,daily')),
'ignore_exceptions' => false,
],
@ -67,14 +67,14 @@ return [
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'level' => env('LOG_LEVEL', 'warning'),
'days' => env('LOG_DAILY_DAYS', 10),
'replace_placeholders' => true,
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'level' => env('LOG_LEVEL', 'warning'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',