From fbaf866e209ece4f35ac3352c6342191011b189f Mon Sep 17 00:00:00 2001 From: samir Date: Tue, 12 Nov 2024 12:59:41 +0100 Subject: [PATCH] fix(http): use default log config only if no config is provided (#719) --- src/Tempest/Console/src/ConsoleApplication.php | 10 ++++++++-- src/Tempest/Http/src/HttpApplication.php | 13 ++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Tempest/Console/src/ConsoleApplication.php b/src/Tempest/Console/src/ConsoleApplication.php index 513b5cbe9..be1e155af 100644 --- a/src/Tempest/Console/src/ConsoleApplication.php +++ b/src/Tempest/Console/src/ConsoleApplication.php @@ -40,8 +40,14 @@ public static function boot( $consoleConfig->name = $name; $logConfig = $container->get(LogConfig::class); - $logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log'); - $logConfig->channels[] = new AppendLogChannel(PathHelper::make($container->get(Kernel::class)->root, '/log/tempest.log')); + + if ( + $logConfig->debugLogPath === null + && $logConfig->channels === [] + ) { + $logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log'); + $logConfig->channels[] = new AppendLogChannel(PathHelper::make($container->get(Kernel::class)->root, '/log/tempest.log')); + } return $application; } diff --git a/src/Tempest/Http/src/HttpApplication.php b/src/Tempest/Http/src/HttpApplication.php index 72561292a..4b6d1c581 100644 --- a/src/Tempest/Http/src/HttpApplication.php +++ b/src/Tempest/Http/src/HttpApplication.php @@ -35,9 +35,16 @@ public static function boot( // Application-specific setup $logConfig = $container->get(LogConfig::class); - $logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log'); - $logConfig->serverLogPath = env('SERVER_LOG'); - $logConfig->channels[] = new AppendLogChannel(PathHelper::make($root, '/log/tempest.log')); + + if ( + $logConfig->debugLogPath === null + && $logConfig->serverLogPath === null + && $logConfig->channels === [] + ) { + $logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log'); + $logConfig->serverLogPath = env('SERVER_LOG'); + $logConfig->channels[] = new AppendLogChannel(PathHelper::make($root, '/log/tempest.log')); + } return $application; }