From 709c3d136420fcbf6a33eb527559d792dd7e3b5b Mon Sep 17 00:00:00 2001 From: Amir Saudagar Date: Wed, 15 Oct 2025 07:21:22 +0530 Subject: [PATCH 1/6] docs(medic#10357): document LOG_LEVEL environment variable for configurable logging --- content/en/hosting/cht/docker/logs.md | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/content/en/hosting/cht/docker/logs.md b/content/en/hosting/cht/docker/logs.md index cb1597b970..b978f5fabe 100644 --- a/content/en/hosting/cht/docker/logs.md +++ b/content/en/hosting/cht/docker/logs.md @@ -28,6 +28,34 @@ CHT has the following services running via Docker and each can have its logs que By default, the CHT server logs are set to the `info` level. To change the log level to `debug`, you can set the `NODE_ENV` environment variable to `development`. A log level of `debug` can affect system performance and cause log files sizes to grow rapidly. It is recommended to temporarily set the log level to `debug` only when needed for troubleshooting. +### Configuring log level via environment variable + +From version 4.x onward, you can also set the log level explicitly using the `LOG_LEVEL` environment variable. This allows more flexibility when `NODE_ENV` alone isn’t sufficient. + +**Example usage:** + +```bash +export LOG_LEVEL=debug +docker compose up -d +``` + +Supported values include: + +* `error` +* `warn` +* `info` +* `debug` + +If the `LOG_LEVEL` variable is **not set**, CHT applies the following defaults: + +* `debug` when `NODE_ENV=development` +* `info` when `NODE_ENV=production` + +> [!NOTE] +> Setting a lower log level (e.g., `debug`) may increase verbosity and reduce performance in production environments. Use only for troubleshooting. + + + ## Viewing logs First, find the actual names of the containers with the `docker ps --format '{{.Names}}'` command which should show something like this: From 61147dced974de177eb6cec909ca37f823145b01 Mon Sep 17 00:00:00 2001 From: Amir Saudagar Date: Wed, 29 Oct 2025 19:53:06 +0530 Subject: [PATCH 2/6] docs(medic#10357): update log level section to reflect new LOG_LEVEL behavior --- content/en/hosting/cht/docker/logs.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/content/en/hosting/cht/docker/logs.md b/content/en/hosting/cht/docker/logs.md index b978f5fabe..3e0421d2fe 100644 --- a/content/en/hosting/cht/docker/logs.md +++ b/content/en/hosting/cht/docker/logs.md @@ -26,11 +26,13 @@ CHT has the following services running via Docker and each can have its logs que ## Setting log level -By default, the CHT server logs are set to the `info` level. To change the log level to `debug`, you can set the `NODE_ENV` environment variable to `development`. A log level of `debug` can affect system performance and cause log files sizes to grow rapidly. It is recommended to temporarily set the log level to `debug` only when needed for troubleshooting. +By default, the CHT server logs are set to the `info` level, regardless of the environment (`NODE_ENV`). + +To adjust the verbosity, you can set the `LOG_LEVEL` environment variable before starting the containers. ### Configuring log level via environment variable -From version 4.x onward, you can also set the log level explicitly using the `LOG_LEVEL` environment variable. This allows more flexibility when `NODE_ENV` alone isn’t sufficient. +From version 4.x onward, the log level can be configured explicitly using the `LOG_LEVEL` environment variable. This allows admins to control log verbosity independently of the `NODE_ENV` setting. **Example usage:** @@ -46,13 +48,10 @@ Supported values include: * `info` * `debug` -If the `LOG_LEVEL` variable is **not set**, CHT applies the following defaults: - -* `debug` when `NODE_ENV=development` -* `info` when `NODE_ENV=production` +If LOG_LEVEL is **not set**, , the system defaults to info. > [!NOTE] -> Setting a lower log level (e.g., `debug`) may increase verbosity and reduce performance in production environments. Use only for troubleshooting. +> The NODE_ENV variable no longer affects logging verbosity. Use LOG_LEVEL to manage log detail. Setting a lower log level (like debug) may reduce performance in production, so use it only for troubleshooting. From a25111ba98a97297d32385ae4f4190e1a602e5be Mon Sep 17 00:00:00 2001 From: Amir Saudagar Date: Sun, 9 Nov 2025 15:27:49 +0530 Subject: [PATCH 3/6] docs(medic#10357): update LOG_LEVEL section based on review feedback --- content/en/hosting/cht/docker/logs.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/content/en/hosting/cht/docker/logs.md b/content/en/hosting/cht/docker/logs.md index 3e0421d2fe..c3c4318016 100644 --- a/content/en/hosting/cht/docker/logs.md +++ b/content/en/hosting/cht/docker/logs.md @@ -26,13 +26,18 @@ CHT has the following services running via Docker and each can have its logs que ## Setting log level -By default, the CHT server logs are set to the `info` level, regardless of the environment (`NODE_ENV`). +By default, the CHT server logs are set to the `info` level. + +> [!NOTE] +> From version 5.1.0 onward, the `NODE_ENV` value will not affect logging verbosity. +> Use the `LOG_LEVEL` environment variable instead to control log detail. + To adjust the verbosity, you can set the `LOG_LEVEL` environment variable before starting the containers. ### Configuring log level via environment variable -From version 4.x onward, the log level can be configured explicitly using the `LOG_LEVEL` environment variable. This allows admins to control log verbosity independently of the `NODE_ENV` setting. +From version 5.1.0 onward, the log level can be configured explicitly using the `LOG_LEVEL` environment variable. This allows admins to control log verbosity independently of the `NODE_ENV` setting. **Example usage:** @@ -48,12 +53,6 @@ Supported values include: * `info` * `debug` -If LOG_LEVEL is **not set**, , the system defaults to info. - -> [!NOTE] -> The NODE_ENV variable no longer affects logging verbosity. Use LOG_LEVEL to manage log detail. Setting a lower log level (like debug) may reduce performance in production, so use it only for troubleshooting. - - ## Viewing logs From 45faafb71931f0bc3d9d490d24121dcf7d44d07f Mon Sep 17 00:00:00 2001 From: Amir Saudagar <121443390+AmirSaudagar55@users.noreply.github.com> Date: Tue, 11 Nov 2025 07:48:53 +0530 Subject: [PATCH 4/6] docs(medic#10357): apply reviewer feedback on LOG_LEVEL section Co-authored-by: Sugat Bajracharya <30311933+sugat009@users.noreply.github.com> --- content/en/hosting/cht/docker/logs.md | 36 +++++++++++++++------------ 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/content/en/hosting/cht/docker/logs.md b/content/en/hosting/cht/docker/logs.md index c3c4318016..0a126c258d 100644 --- a/content/en/hosting/cht/docker/logs.md +++ b/content/en/hosting/cht/docker/logs.md @@ -26,33 +26,37 @@ CHT has the following services running via Docker and each can have its logs que ## Setting log level -By default, the CHT server logs are set to the `info` level. +To control log verbosity, set the `LOG_LEVEL` environment variable before starting the containers. The default value is `info`. -> [!NOTE] -> From version 5.1.0 onward, the `NODE_ENV` value will not affect logging verbosity. -> Use the `LOG_LEVEL` environment variable instead to control log detail. - +{{< callout type="info" >}} +From version 5.1.0 onward, use `LOG_LEVEL` to control log verbosity. The `NODE_ENV` value no longer affects logging detail. +{{< /callout >}} -To adjust the verbosity, you can set the `LOG_LEVEL` environment variable before starting the containers. - -### Configuring log level via environment variable - -From version 5.1.0 onward, the log level can be configured explicitly using the `LOG_LEVEL` environment variable. This allows admins to control log verbosity independently of the `NODE_ENV` setting. +### Configuration **Example usage:** - ```bash export LOG_LEVEL=debug docker compose up -d ``` +**Supported values:** -Supported values include: +- `error` — Only error messages (production use) +- `warn` — Warnings and errors +- `info` — General information (default, recommended for production) +- `debug` — Detailed diagnostic information (troubleshooting only) -* `error` -* `warn` -* `info` -* `debug` +{{< callout type="warning" >}} +Using `debug` level generates significantly more logs and may impact performance. Use it only for troubleshooting and switch back to `info` or `warn` for normal operations. +{{< /callout >}} +### Applying changes to running containers + +To change the log level for already running containers, update the environment variable and restart: +```bash +export LOG_LEVEL=warn +docker compose restart +``` ## Viewing logs From b2154642e2c78e8d6cc166db2b4740ae3744b963 Mon Sep 17 00:00:00 2001 From: Sugat Bajracharya Date: Mon, 30 Mar 2026 18:50:44 +0545 Subject: [PATCH 5/6] docs(medic#10357): fix LOG_LEVEL documentation for Docker deployments --- content/en/hosting/cht/docker/logs.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/content/en/hosting/cht/docker/logs.md b/content/en/hosting/cht/docker/logs.md index 0a126c258d..daf4f8fdfb 100644 --- a/content/en/hosting/cht/docker/logs.md +++ b/content/en/hosting/cht/docker/logs.md @@ -26,7 +26,7 @@ CHT has the following services running via Docker and each can have its logs que ## Setting log level -To control log verbosity, set the `LOG_LEVEL` environment variable before starting the containers. The default value is `info`. +To control log verbosity, set the `LOG_LEVEL` environment variable for the `api` and `sentinel` containers. The default value is `info`. {{< callout type="info" >}} From version 5.1.0 onward, use `LOG_LEVEL` to control log verbosity. The `NODE_ENV` value no longer affects logging detail. @@ -34,11 +34,17 @@ From version 5.1.0 onward, use `LOG_LEVEL` to control log verbosity. The `NODE_E ### Configuration -**Example usage:** +Add `LOG_LEVEL` to the `.env` file used by your Docker Compose deployment: + +``` +LOG_LEVEL=debug +``` + +Then start or recreate the containers: ```bash -export LOG_LEVEL=debug docker compose up -d ``` + **Supported values:** - `error` — Only error messages (production use) @@ -52,12 +58,15 @@ Using `debug` level generates significantly more logs and may impact performance ### Applying changes to running containers -To change the log level for already running containers, update the environment variable and restart: +To change the log level for already running containers, update the `LOG_LEVEL` value in your `.env` file and recreate the containers: ```bash -export LOG_LEVEL=warn -docker compose restart +docker compose up -d ``` +{{< callout type="info" >}} +`docker compose restart` does not pick up environment variable changes. Use `docker compose up -d` to recreate the containers with the new configuration. +{{< /callout >}} + ## Viewing logs First, find the actual names of the containers with the `docker ps --format '{{.Names}}'` command which should show something like this: From 1614dc24e2b53bcdf7084b60d281c9db0333199b Mon Sep 17 00:00:00 2001 From: Sugat Bajracharya Date: Thu, 2 Apr 2026 10:51:58 +0545 Subject: [PATCH 6/6] feedback changes --- content/en/hosting/cht/docker/logs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/hosting/cht/docker/logs.md b/content/en/hosting/cht/docker/logs.md index daf4f8fdfb..cfbe515ecb 100644 --- a/content/en/hosting/cht/docker/logs.md +++ b/content/en/hosting/cht/docker/logs.md @@ -47,7 +47,7 @@ docker compose up -d **Supported values:** -- `error` — Only error messages (production use) +- `error` — Only error messages - `warn` — Warnings and errors - `info` — General information (default, recommended for production) - `debug` — Detailed diagnostic information (troubleshooting only)