From f9c06465dd15065690ff4c5b17d7dee9d1d976fc Mon Sep 17 00:00:00 2001 From: Scott Koranda Date: Fri, 16 Dec 2022 05:23:17 -0600 Subject: [PATCH] container dynamic log config by env variable (CO-2567) --- app/config/app.php | 78 ++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/app/config/app.php b/app/config/app.php index 9f35ce8bd..8ab241079 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -365,32 +365,58 @@ /* * Configures logging options */ - 'Log' => [ - 'debug' => [ - 'className' => FileLog::class, - 'path' => LOGS, - 'file' => 'debug', - 'url' => env('LOG_DEBUG_URL', null), - 'scopes' => false, - 'levels' => ['notice', 'info', 'debug'], - ], - 'error' => [ - 'className' => FileLog::class, - 'path' => LOGS, - 'file' => 'error', - 'url' => env('LOG_ERROR_URL', null), - 'scopes' => false, - 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], - ], - // To enable this dedicated query log, you need set your datasource's log flag to true - 'queries' => [ - 'className' => FileLog::class, - 'path' => LOGS, - 'file' => 'queries', - 'url' => env('LOG_QUERIES_URL', null), - 'scopes' => ['queriesLog'], - ], - ], + 'Log' => null !== env('COMANAGE_MATCH_CONTAINER', null) + // Configuration for container deployments + ? [ + 'debug' => [ + 'className' => 'Cake\Log\Engine\ConsoleLog', + 'stream' => 'php://stdout', + 'outputAs' => 0, + 'scopes' => false, + 'levels' => ['notice', 'info', 'debug'], + ], + 'error' => [ + 'className' => 'Cake\Log\Engine\ConsoleLog', + 'stream' => 'php://stderr', + 'outputAs' => 0, + 'scopes' => false, + 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], + ], + 'queries' => [ + 'className' => 'Cake\Log\Engine\ConsoleLog', + 'stream' => 'php://stdout', + 'outputAs' => 0, + 'scopes' => ['queriesLog'], + ], + + ] + // Configuration for traditional deployments + : [ + 'debug' => [ + 'className' => FileLog::class, + 'path' => LOGS, + 'file' => 'debug', + 'url' => env('LOG_DEBUG_URL', null), + 'scopes' => false, + 'levels' => ['notice', 'info', 'debug'], + ], + 'error' => [ + 'className' => FileLog::class, + 'path' => LOGS, + 'file' => 'error', + 'url' => env('LOG_ERROR_URL', null), + 'scopes' => false, + 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], + ], + // To enable this dedicated query log, you need set your datasource's log flag to true + 'queries' => [ + 'className' => FileLog::class, + 'path' => LOGS, + 'file' => 'queries', + 'url' => env('LOG_QUERIES_URL', null), + 'scopes' => ['queriesLog'], + ], + ], /* * Session configuration.