Skip to content

Commit fbaf866

Browse files
authored
fix(http): use default log config only if no config is provided (tempestphp#719)
1 parent ccc1ece commit fbaf866

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/Tempest/Console/src/ConsoleApplication.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ public static function boot(
4040
$consoleConfig->name = $name;
4141

4242
$logConfig = $container->get(LogConfig::class);
43-
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
44-
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($container->get(Kernel::class)->root, '/log/tempest.log'));
43+
44+
if (
45+
$logConfig->debugLogPath === null
46+
&& $logConfig->channels === []
47+
) {
48+
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
49+
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($container->get(Kernel::class)->root, '/log/tempest.log'));
50+
}
4551

4652
return $application;
4753
}

src/Tempest/Http/src/HttpApplication.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@ public static function boot(
3535

3636
// Application-specific setup
3737
$logConfig = $container->get(LogConfig::class);
38-
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
39-
$logConfig->serverLogPath = env('SERVER_LOG');
40-
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($root, '/log/tempest.log'));
38+
39+
if (
40+
$logConfig->debugLogPath === null
41+
&& $logConfig->serverLogPath === null
42+
&& $logConfig->channels === []
43+
) {
44+
$logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
45+
$logConfig->serverLogPath = env('SERVER_LOG');
46+
$logConfig->channels[] = new AppendLogChannel(PathHelper::make($root, '/log/tempest.log'));
47+
}
4148

4249
return $application;
4350
}

0 commit comments

Comments
 (0)