From 4807fc40a6e9516aa8dbab3874d9bf0b23b83ac0 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Fri, 17 May 2024 11:44:22 -0400 Subject: [PATCH] refactor!: LOG_LEVEL => IMMICH_LOG_LEVEL (#9557) refactor: LOG_LEVEL => IMMICH_LOG_LEVEL --- docs/docs/features/ml-hardware-acceleration.md | 2 +- docs/docs/install/environment-variables.md | 2 +- machine-learning/app/config.py | 4 ++-- server/src/config.ts | 2 +- server/src/main.ts | 2 +- server/src/services/system-config.service.ts | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/docs/features/ml-hardware-acceleration.md b/docs/docs/features/ml-hardware-acceleration.md index 84c4a4e6bd..2bcb5ee8e8 100644 --- a/docs/docs/features/ml-hardware-acceleration.md +++ b/docs/docs/features/ml-hardware-acceleration.md @@ -95,7 +95,7 @@ immich-machine-learning: Once this is done, you can redeploy the `immich-machine-learning` container. :::info -You can confirm the device is being recognized and used by checking its utilization (via `nvtop` for CUDA, `intel_gpu_top` for OpenVINO, etc.). You can also enable debug logging by setting `LOG_LEVEL=debug` in the `.env` file and restarting the `immich-machine-learning` container. When a Smart Search or Face Detection job begins, you should see a log for `Available ORT providers` containing the relevant provider. In the case of ARM NN, the absence of a `Could not load ANN shared libraries` log entry means it loaded successfully. +You can confirm the device is being recognized and used by checking its utilization (via `nvtop` for CUDA, `intel_gpu_top` for OpenVINO, etc.). You can also enable debug logging by setting `IMMICH_LOG_LEVEL=debug` in the `.env` file and restarting the `immich-machine-learning` container. When a Smart Search or Face Detection job begins, you should see a log for `Available ORT providers` containing the relevant provider. In the case of ARM NN, the absence of a `Could not load ANN shared libraries` log entry means it loaded successfully. ::: [hw-file]: https://github.com/immich-app/immich/releases/latest/download/hwaccel.ml.yml diff --git a/docs/docs/install/environment-variables.md b/docs/docs/install/environment-variables.md index 5b498f1b27..d4b5664fbc 100644 --- a/docs/docs/install/environment-variables.md +++ b/docs/docs/install/environment-variables.md @@ -42,7 +42,7 @@ Regardless of filesystem, it is not recommended to use a network share for your | :------------------------------ | :------------------------------------------- | :----------------------: | :-------------------------------------- | | `TZ` | Timezone | | microservices | | `NODE_ENV` | Environment (production, development) | `production` | server, microservices, machine learning | -| `LOG_LEVEL` | Log Level (verbose, debug, log, warn, error) | `log` | server, microservices, machine learning | +| `IMMICH_LOG_LEVEL` | Log Level (verbose, debug, log, warn, error) | `log` | server, microservices, machine learning | | `IMMICH_MEDIA_LOCATION` | Media Location | `./upload`\*1 | server, microservices | | `IMMICH_CONFIG_FILE` | Path to config file | | server, microservices | | `IMMICH_WEB_ROOT` | Path of root index.html | `/usr/src/app/www` | server | diff --git a/machine-learning/app/config.py b/machine-learning/app/config.py index a911659dbc..ab27499a25 100644 --- a/machine-learning/app/config.py +++ b/machine-learning/app/config.py @@ -41,7 +41,7 @@ class Settings(BaseSettings): class LogSettings(BaseSettings): - log_level: str = "info" + immich_log_level: str = "info" no_color: bool = False class Config: @@ -77,7 +77,7 @@ LOG_LEVELS: dict[str, int] = { settings = Settings() log_settings = LogSettings() -LOG_LEVEL = LOG_LEVELS.get(log_settings.log_level.lower(), logging.INFO) +LOG_LEVEL = LOG_LEVELS.get(log_settings.immich_log_level.lower(), logging.INFO) class CustomRichHandler(RichHandler): diff --git a/server/src/config.ts b/server/src/config.ts index 3ad981f97d..1f4ed9f0eb 100644 --- a/server/src/config.ts +++ b/server/src/config.ts @@ -361,7 +361,7 @@ export const immichAppConfig: ConfigModuleOptions = { isGlobal: true, validationSchema: Joi.object({ NODE_ENV: Joi.string().optional().valid('development', 'production', 'staging').default('development'), - LOG_LEVEL: Joi.string() + IMMICH_LOG_LEVEL: Joi.string() .optional() .valid(...Object.values(LogLevel)), diff --git a/server/src/main.ts b/server/src/main.ts index 84ba1f056d..167c772690 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -10,7 +10,7 @@ if (process.argv[2] === immichApp) { } async function bootstrapImmichAdmin() { - process.env.LOG_LEVEL = LogLevel.WARN; + process.env.IMMICH_LOG_LEVEL = LogLevel.WARN; await CommandFactory.run(ImmichAdminModule); } diff --git a/server/src/services/system-config.service.ts b/server/src/services/system-config.service.ts index 3474771875..e198888020 100644 --- a/server/src/services/system-config.service.ts +++ b/server/src/services/system-config.service.ts @@ -62,7 +62,7 @@ export class SystemConfigService { @OnServerEvent(ServerAsyncEvent.CONFIG_VALIDATE) onValidateConfig({ newConfig, oldConfig }: ServerAsyncEventMap[ServerAsyncEvent.CONFIG_VALIDATE]) { if (!_.isEqual(instanceToPlain(newConfig.logging), oldConfig.logging) && this.getEnvLogLevel()) { - throw new Error('Logging cannot be changed while the environment variable LOG_LEVEL is set.'); + throw new Error('Logging cannot be changed while the environment variable IMMICH_LOG_LEVEL is set.'); } } @@ -135,10 +135,10 @@ export class SystemConfigService { const configLevel = logging.enabled ? logging.level : false; const level = envLevel ?? configLevel; this.logger.setLogLevel(level); - this.logger.log(`LogLevel=${level} ${envLevel ? '(set via LOG_LEVEL)' : '(set via system config)'}`); + this.logger.log(`LogLevel=${level} ${envLevel ? '(set via IMMICH_LOG_LEVEL)' : '(set via system config)'}`); } private getEnvLogLevel() { - return process.env.LOG_LEVEL as LogLevel; + return process.env.IMMICH_LOG_LEVEL as LogLevel; } }