From e267907496fe7b7bc03f87e6db1fb31409ff5ba3 Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Wed, 26 Jun 2024 12:59:44 -0700 Subject: [PATCH] fix(cmd-api-server): stop changing LoggerProvider log level 1. The API server was mutating global shared state in it's own constructor which was causing problems with other components (pretty much all of them) 2. I deleted the line that copies the API server's own log level to the LoggerProvider so that the API server's log level can be it's own. 3. The way this bug came about is that in the supply chain app example in the back-end the API server had to be muted (log level WARN) in order for it to stop printing misleading logs due to us binding to the wildcard host it would claim in its own logs that the WWW GUI is accessible on the wildcard host in a web browser, but this was wrong and caused many people a lot of confusion unfortunately. 4. The fix for the supply chain app is to set the API server's log level to WARN and have the supply chain app itself log the correct URLs to the console. 5. The issue I ran into with that fix is that as soon as I set the log level of the API server to WARN, everything else also stopped logging which resulted in my fix making everything worse since now the users had absolutely no idea what was happening or if the example application had even finished booting up or not. 6. Upon further debugging I discovered that the API server was forcing its own log level onto everybody else as the root cause. 7. A follow-up PR is about to drop with the supply chain app fixes which are dependent on this one making it in first. Signed-off-by: Peter Somogyvari --- .../cactus-cmd-api-server/src/main/typescript/api-server.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts b/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts index 7cb254f3a96..62d00aa7ba0 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts @@ -160,8 +160,6 @@ export class ApiServer { exitHook(() => this.shutdown()); } - LoggerProvider.setLogLevel(options.config.logLevel); - if (this.options.httpServerApi) { this.httpServerApi = this.options.httpServerApi; } else if (this.options.config.apiTlsEnabled) {