Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
2359ff6
fix(#10357): prevent DEBUG logs from appearing in production
AmirSaudagar55 Oct 13, 2025
aaf1b72
fix(#10357): prevent DEBUG logs from appearing in production
AmirSaudagar55 Oct 13, 2025
21c0f37
Merge branch '10357-fix-debug-logs' of https://github.com/AmirSaudaga…
AmirSaudagar55 Oct 14, 2025
35cad51
fix(#10357): lib-broswer file undo changes
AmirSaudagar55 Oct 14, 2025
54946c0
Merge branch 'master' into 10357-fix-debug-logs
AmirSaudagar55 Oct 15, 2025
554b46c
fix(#10357): Log level defaults to 'info' if not explicitly set.
AmirSaudagar55 Oct 20, 2025
517e265
Merge branch '10357-fix-debug-logs' of https://github.com/AmirSaudaga…
AmirSaudagar55 Oct 20, 2025
e48efbb
test(medic#10357): run integration and webdriver tests with LOG_LEVEL…
AmirSaudagar55 Nov 11, 2025
e62a367
Merge branch 'master' into 10357-fix-debug-logs
AmirSaudagar55 Nov 11, 2025
5f05c3b
test(medic#10357): inject LOG_LEVEL into generated compose files for …
AmirSaudagar55 Nov 19, 2025
4d2893d
Merge branch '10357-fix-debug-logs' of https://github.com/AmirSaudaga…
AmirSaudagar55 Nov 19, 2025
9472fda
chore(medic#10357): fix eslint issues in generateComposeFiles
AmirSaudagar55 Nov 25, 2025
901f44d
test(medic#10357): ensure LOG_LEVEL is debug in k3d integration tests
AmirSaudagar55 Dec 1, 2025
638c8ab
Merge branch 'master' into 10357-fix-debug-logs
sugat009 Dec 11, 2025
eb162af
Update scripts/build/helm/templates/sentinel/deployment.yaml
sugat009 Dec 12, 2025
aa5e430
Merge branch 'master' into 10357-fix-debug-logs
andrablaj Dec 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
"-- CI SCRIPTS ": "-----------------------------------------------------------------------------------------------",
"build": "./scripts/build/build-ci.sh",
"ci-compile": "node scripts/ci/check-versions.js && node scripts/build/cli npmCiModules && npm run lint && npm run unit-nginx && npm run unit-haproxy && npm run unit-haproxy-healthcheck && npm run unit-cht-deploy && npm run build && npm run integration-api && npm run unit",
"ci-integration-all": "mocha --config tests/integration/.mocharc-all.js",
"ci-integration-replication": "mocha --config tests/integration/.mocharc-replication.js",
"ci-integration-all-k3d": "mocha --config tests/integration/.mocharc-k3d.js",
"ci-integration-sentinel": "mocha --config tests/integration/.mocharc-sentinel.js",
"ci-integration-sentinel-k3d": "mocha --config tests/integration/.mocharc-sentinel-k3d.js",
"ci-webdriver-default": "wdio run ./tests/e2e/default/wdio.conf.js",
"ci-webdriver-default-mobile": "wdio run ./tests/e2e/default-mobile/wdio.conf.js",
"ci-webdriver-visual-desktop": "wdio run ./tests/e2e/visual/wdio.conf.js --suite=desktopTests",
"ci-webdriver-visual-mobile": "wdio run ./tests/e2e/visual/wdio.conf.js --suite=mobileTests",
"ci-integration-all": "LOG_LEVEL=debug mocha --config tests/integration/.mocharc-all.js",
"ci-integration-replication": "LOG_LEVEL=debug mocha --config tests/integration/.mocharc-replication.js",
"ci-integration-all-k3d": "LOG_LEVEL=debug mocha --config tests/integration/.mocharc-k3d.js",
"ci-integration-sentinel": "LOG_LEVEL=debug mocha --config tests/integration/.mocharc-sentinel.js",
"ci-integration-sentinel-k3d": "LOG_LEVEL=debug mocha --config tests/integration/.mocharc-sentinel-k3d.js",
"ci-webdriver-default": "LOG_LEVEL=debug wdio run ./tests/e2e/default/wdio.conf.js",
"ci-webdriver-default-mobile": "LOG_LEVEL=debug wdio run ./tests/e2e/default-mobile/wdio.conf.js",
"ci-webdriver-visual-desktop": "LOG_LEVEL=debug wdio run ./tests/e2e/visual/wdio.conf.js --suite=desktopTests",
"ci-webdriver-visual-mobile": "LOG_LEVEL=debug wdio run ./tests/e2e/visual/wdio.conf.js --suite=mobileTests",
"publish-for-testing": "./scripts/build/build-service-images.sh && mkdir -p images && node scripts/build/cli publishServiceImages && node ./scripts/build/ddoc-compile.js staging && node ./scripts/build/push-ddoc-to-staging.js",
"test-config-covid-19": "cd config/covid-19 && npm run test",
"test-config-default": "cd config/default && npm run test",
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/helm/templates/api/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
terminationGracePeriodSeconds: 0
containers:
- env:
- name: LOG_LEVEL
value: '{{ .Values.api.log_level | default "info" }}'
- name: BUILDS_URL
value: {{ .Values.upstream_servers.builds_url | default "https://staging.dev.medicmobile.org/_couch/builds_4" }}
- name: COUCH_URL
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/helm/templates/sentinel/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ spec:
spec:
containers:
- env:
- name: LOG_LEVEL
value: '{{ .Values.sentinel.log_level | default "info" }}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AmirSaudagar55 the log_level: "info" needs to be added in the scripts/build/helm/values/base.yaml file as well. Beforehand your changes were passing because sentinel template was trying to access they key from the API service which did not exist and was defaulting to info but I thought the helm template had a typo and I changed the value in the sentinel helm template to use the value from the sentinel itself which is causing the CI to fail.

The changes would look something like this in the scripts/build/helm/values/base.yaml file.

...
# API Service configuration <- Line 7
api:
  service:
    type: ClusterIP # DEFAULT: Good default for internal services
  log_level: "info" # DEFAULT: Log level for API service

# Sentinel Service configuration
sentinel:
  log_level: "info" # DEFAULT: Log level for Sentinel service
...

- name: API_HOST
value: api.{{ .Values.namespace }}.svc.cluster.local
- name: COUCH_URL
Expand Down
7 changes: 7 additions & 0 deletions scripts/build/helm/tests/integration-k3d-values.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ local_storage:
preExistingDiskPath-2: "{{{data_path}}}/srv2"
preExistingDiskPath-3: "{{{data_path}}}/srv3"

# API log level for integration tests
api:
log_level: "debug"

# Sentinel log level for integration tests
sentinel:
log_level: "debug"
6 changes: 4 additions & 2 deletions shared-libs/logger/src/node-logger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { createLogger, format, transports } = require('winston');
const env = process.env.NODE_ENV || 'development';
// LOG_LEVEL controls logging globally. Defaults to 'info' if not explicitly set.
const logLevel = process.env.LOG_LEVEL || 'info';


const cleanUpErrorsFromSymbolProperties = (info) => {
if (!info) {
Expand Down Expand Up @@ -61,7 +63,7 @@ module.exports.create = (dateFormat) => createLogger({
transports: [
new transports.Console({
// change level if in dev environment versus production
level: env === 'development' ? 'debug' : 'info',
level: logLevel,
format: format.combine(
// https://github.com/winstonjs/winston/issues/1345
format(info => {
Expand Down
31 changes: 30 additions & 1 deletion tests/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1174,12 +1174,41 @@ const generateComposeFiles = async () => {
couchdb_servers: 'couchdb-1.local,couchdb-2.local,couchdb-3.local',
};

const INJECT_SERVICES = ['api', 'sentinel'];

for (const file of COMPOSE_FILES) {
const templatePath = getTemplateComposeFilePath(file);
const testComposePath = getTestComposeFilePath(file);

const template = await fs.promises.readFile(templatePath, 'utf-8');
await fs.promises.writeFile(testComposePath, mustache.render(template, view));
let compiled = mustache.render(template, view);

INJECT_SERVICES.forEach((svc) => {
const svcHeader = `\n ${svc}:`;
const start = compiled.indexOf(svcHeader);
if (start === -1) {
return;
}

const rest = compiled.slice(start + 1);

const nextServiceMatch = rest.search(/\n {2}[a-zA-Z0-9_-]+:/);
const block = nextServiceMatch === -1 ? rest : rest.slice(0, nextServiceMatch + 1);

const envMarker = '\n environment:\n';
const envIdxInBlock = block.indexOf(envMarker);

if (envIdxInBlock !== -1) {
const insertPos = start + 1 + envIdxInBlock + envMarker.length;
const logLine = ' - "LOG_LEVEL=${LOG_LEVEL:-debug}"\n';
compiled = compiled.slice(0, insertPos) + logLine + compiled.slice(insertPos);
} else {
const serviceLineEnd = compiled.indexOf('\n', start + 1) + 1;
const insertion = ' environment:\n - "LOG_LEVEL=${LOG_LEVEL:-debug}"\n';
compiled = compiled.slice(0, serviceLineEnd) + insertion + compiled.slice(serviceLineEnd);
}
});
await fs.promises.writeFile(testComposePath, compiled);
}
};

Expand Down