Conditional/additional logging channel for docker deplyoment based on IS_DOCKER

This commit is contained in:
Benjamin Brummer
2025-10-09 12:46:51 +02:00
parent 12f31054c9
commit 6caa0b066d

View File

@@ -3,6 +3,7 @@
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
@@ -32,7 +33,7 @@ return [
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
@@ -53,43 +54,64 @@ return [
'channels' => [
'invoiceninja' => [
'driver' => 'stack',
'channels' => ['invoiceninja-single', env('IS_DOCKER', false) ? 'stderr' : 'null'],
'ignore_exceptions' => false,
],
'invoiceninja-single' => [
'driver' => 'single',
'path' => storage_path('logs/invoiceninja.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 7,
],
'invoiceninja-reminders' => [
'driver' => 'stack',
'channels' => ['invoiceninja-reminders-single', env('IS_DOCKER', false) ? 'stderr' : 'null'],
'ignore_exceptions' => false,
],
'invoiceninja-reminders-single' => [
'driver' => 'single',
'path' => storage_path('logs/invoiceninja-reminders.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 90,
],
'deprecations' => [
'driver' => 'stack',
'channels' => array_merge(explode(',', (string) env('LOG_DEPRECATIONS', 'single')), [env('IS_DOCKER', false) ? 'stderr' : 'null']),
],
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'channels' => array_merge(explode(',', (string) env('LOG_STACK', 'single')), [env('IS_DOCKER', false) ? 'stderr' : 'null']),
'ignore_exceptions' => false,
'days' => 7,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
@@ -101,26 +123,31 @@ return [
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [