From f4e142849757a98c80e879d6129e9f9ef01a6ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Ul=C3=A9n?= Date: Mon, 24 Oct 2022 10:07:13 +0200 Subject: [PATCH 1/3] Made RR log level configurable --- src/Commands/StartRoadRunnerCommand.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Commands/StartRoadRunnerCommand.php b/src/Commands/StartRoadRunnerCommand.php index fcf3592c7..de83bdf16 100644 --- a/src/Commands/StartRoadRunnerCommand.php +++ b/src/Commands/StartRoadRunnerCommand.php @@ -29,7 +29,8 @@ class StartRoadRunnerCommand extends Command implements SignalableCommandInterfa {--max-requests=500 : The number of requests to process before reloading the server} {--rr-config= : The path to the RoadRunner .rr.yaml file} {--watch : Automatically reload the server when the application is modified} - {--poll : Use file system polling while watching in order to watch files over a network}'; + {--poll : Use file system polling while watching in order to watch files over a network} + {--log-level= : Suppress messages under this log level}'; /** * The command's description. @@ -87,7 +88,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve '-o', 'http.static.dir='.base_path('public'), '-o', 'http.middleware='.config('octane.roadrunner.http_middleware', 'static'), '-o', 'logs.mode=production', - '-o', app()->environment('local') ? 'logs.level=debug' : 'logs.level=warn', + '-o', 'logs.level='.$this->logLevel(), '-o', 'logs.output=stdout', '-o', 'logs.encoding=json', 'serve', @@ -176,6 +177,17 @@ protected function rpcPort() return $this->option('rpc-port') ?: $this->option('port') - 1999; } + /** + * Suppress messages under this log level. + * + * @return string + */ + protected function logLevel() + { + return $this->option('log-level') ?: + (app()->environment('local') ? 'debug' : 'warn'); + } + /** * Write the server process output to the console. * From d9058a3ef879bb67b40c8177b2f166f387c4429f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 24 Oct 2022 08:26:18 -0500 Subject: [PATCH 2/3] formatting --- src/Commands/StartRoadRunnerCommand.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Commands/StartRoadRunnerCommand.php b/src/Commands/StartRoadRunnerCommand.php index de83bdf16..e172ff98d 100644 --- a/src/Commands/StartRoadRunnerCommand.php +++ b/src/Commands/StartRoadRunnerCommand.php @@ -30,7 +30,7 @@ class StartRoadRunnerCommand extends Command implements SignalableCommandInterfa {--rr-config= : The path to the RoadRunner .rr.yaml file} {--watch : Automatically reload the server when the application is modified} {--poll : Use file system polling while watching in order to watch files over a network} - {--log-level= : Suppress messages under this log level}'; + {--log-level= : Log messages at or above the specified log level}'; /** * The command's description. @@ -88,7 +88,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve '-o', 'http.static.dir='.base_path('public'), '-o', 'http.middleware='.config('octane.roadrunner.http_middleware', 'static'), '-o', 'logs.mode=production', - '-o', 'logs.level='.$this->logLevel(), + '-o', 'logs.level='.$this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn'), '-o', 'logs.output=stdout', '-o', 'logs.encoding=json', 'serve', @@ -177,17 +177,6 @@ protected function rpcPort() return $this->option('rpc-port') ?: $this->option('port') - 1999; } - /** - * Suppress messages under this log level. - * - * @return string - */ - protected function logLevel() - { - return $this->option('log-level') ?: - (app()->environment('local') ? 'debug' : 'warn'); - } - /** * Write the server process output to the console. * From 095172f71e7592b7bc5be26b95e9dc412d759d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Ul=C3=A9n?= Date: Wed, 26 Oct 2022 10:44:46 +0200 Subject: [PATCH 3/3] Fixed subtle operator precedence bug --- src/Commands/StartRoadRunnerCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/StartRoadRunnerCommand.php b/src/Commands/StartRoadRunnerCommand.php index e172ff98d..1fbea0a39 100644 --- a/src/Commands/StartRoadRunnerCommand.php +++ b/src/Commands/StartRoadRunnerCommand.php @@ -88,7 +88,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve '-o', 'http.static.dir='.base_path('public'), '-o', 'http.middleware='.config('octane.roadrunner.http_middleware', 'static'), '-o', 'logs.mode=production', - '-o', 'logs.level='.$this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn'), + '-o', 'logs.level='.($this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn')), '-o', 'logs.output=stdout', '-o', 'logs.encoding=json', 'serve',