[PR #3287] [MERGED] fix(server): call isRequestLoggingDisabled() so LOG_DISABLE_REQUEST_LOGGING actually works #5864

Closed
opened 2026-10-22 04:20:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3287
Author: @kolacheee
Created: 7/5/2026
Status: ✅ Merged
Merged: 7/5/2026
Merged by: @SpicyMarinara

Base: staging ← Head: claude/recursing-roentgen-3a4a90


📝 Commits (1)

  • 5a1e3bc fix(server): call isRequestLoggingDisabled() so LOG_DISABLE_REQUEST_LOGGING works

📊 Changes

4 files changed (+7 additions, -4 deletions)

View changed files

📝 docs/CONFIGURATION.md (+1 -1)
📝 docs/REMOTE_ACCESS.md (+2 -2)
📝 packages/server/src/app.ts (+1 -1)
📝 packages/server/src/config/env-watcher.ts (+3 -0)

📄 Description

Why

LOG_DISABLE_REQUEST_LOGGING is silently a no-op today.

In packages/server/src/app.ts, the Fastify factory receives the function reference isRequestLoggingDisabled instead of the result of calling it:

disableRequestLogging: isRequestLoggingDisabled,   // a function object → always truthy

Fastify treats disableRequestLogging as a boolean, and a function object is always truthy, so per-request access logging is permanently disabled no matter what LOG_DISABLE_REQUEST_LOGGING is set to. A user who sets LOG_DISABLE_REQUEST_LOGGING=false (or leaves it at its default of false) and expects to see Fastify's GET /api/... completed access logs never gets them.

This same bug is documented as supporting evidence in #3260 (item 1: "app.ts passes disableRequestLogging the function reference … always truthy, so Fastify request logging is permanently off"). That issue is scoped to REMOTE_ACCESS.md docs drift and assigned to the maintainer; this PR fixes the underlying code defect plus the restart-classification half, tracked by its own issue #3288.

What changed

  1. packages/server/src/app.ts — call the function: disableRequestLogging: isRequestLoggingDisabled(). Now the env var (and the prompt-connections preset, which routes through the same function) actually control request logging.

  2. Restart-classification fix. Even with the call fixed, Fastify reads disableRequestLogging once at boot from the factory options — it cannot hot-reload. The env watcher and docs previously implied LOG_DISABLE_REQUEST_LOGGING applies without a restart, which is now (and always was) wrong. Moved it to the restart-required side:

    • packages/server/src/config/env-watcher.ts — added LOG_DISABLE_REQUEST_LOGGING to RESTART_REQUIRED_KEYS, so changing it now logs the "requires a server restart to take effect" warning.
    • docs/REMOTE_ACCESS.md — moved it from the hot-reload list to the restart-required list under When a restart is required.
    • docs/CONFIGURATION.md — added a "Requires restart" note to its table row, matching the convention used by other boot-bound vars.

LOG_LEVEL and LOG_PRESET are intentionally left as hot-reloadable — the env watcher re-applies the logger level on reload; only the request-logging toggle is bound at boot.

Manual verification (not yet done — please verify)

  • Set LOG_LEVEL=info (default is warn, and Fastify access logs emit at info, so warn hides them regardless) with LOG_DISABLE_REQUEST_LOGGING unset/false, start the server, hit any /api/... route, and confirm GET /api/... completed request logs now appear.
  • With LOG_LEVEL=info and LOG_DISABLE_REQUEST_LOGGING=true, confirm those per-request logs are suppressed.
  • Edit LOG_DISABLE_REQUEST_LOGGING in .env while the server is running and confirm the [env-watcher] warning now says a restart is required (and that the change indeed does not take effect until restart).

Validation

  • pnpm check (TypeScript + ESLint).

Targets staging per CONTRIBUTING.md § Branches / CLAUDE.md.

Fixes #3288. Related: #3260.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3287 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 7/5/2026 **Status:** ✅ Merged **Merged:** 7/5/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `claude/recursing-roentgen-3a4a90` --- ### 📝 Commits (1) - [`5a1e3bc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5a1e3bca1d7b14a73eff1c7a8618460527c230ea) fix(server): call isRequestLoggingDisabled() so LOG_DISABLE_REQUEST_LOGGING works ### 📊 Changes **4 files changed** (+7 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/CONFIGURATION.md` (+1 -1) 📝 `docs/REMOTE_ACCESS.md` (+2 -2) 📝 `packages/server/src/app.ts` (+1 -1) 📝 `packages/server/src/config/env-watcher.ts` (+3 -0) </details> ### 📄 Description ## Why `LOG_DISABLE_REQUEST_LOGGING` is silently a no-op today. In `packages/server/src/app.ts`, the Fastify factory receives the **function reference** `isRequestLoggingDisabled` instead of the result of **calling** it: ```ts disableRequestLogging: isRequestLoggingDisabled, // a function object → always truthy ``` Fastify treats `disableRequestLogging` as a boolean, and a function object is always truthy, so per-request access logging is **permanently disabled** no matter what `LOG_DISABLE_REQUEST_LOGGING` is set to. A user who sets `LOG_DISABLE_REQUEST_LOGGING=false` (or leaves it at its default of `false`) and expects to see Fastify's `GET /api/... completed` access logs never gets them. This same bug is documented as supporting evidence in #3260 (item 1: "app.ts passes disableRequestLogging the function reference … always truthy, so Fastify request logging is permanently off"). That issue is scoped to `REMOTE_ACCESS.md` docs drift and assigned to the maintainer; this PR fixes the underlying code defect plus the restart-classification half, tracked by its own issue #3288. ## What changed 1. **`packages/server/src/app.ts`** — call the function: `disableRequestLogging: isRequestLoggingDisabled()`. Now the env var (and the `prompt-connections` preset, which routes through the same function) actually control request logging. 2. **Restart-classification fix.** Even with the call fixed, Fastify reads `disableRequestLogging` **once at boot** from the factory options — it cannot hot-reload. The env watcher and docs previously implied `LOG_DISABLE_REQUEST_LOGGING` applies without a restart, which is now (and always was) wrong. Moved it to the restart-required side: - `packages/server/src/config/env-watcher.ts` — added `LOG_DISABLE_REQUEST_LOGGING` to `RESTART_REQUIRED_KEYS`, so changing it now logs the "requires a server restart to take effect" warning. - `docs/REMOTE_ACCESS.md` — moved it from the hot-reload list to the restart-required list under *When a restart is required*. - `docs/CONFIGURATION.md` — added a "Requires restart" note to its table row, matching the convention used by other boot-bound vars. `LOG_LEVEL` and `LOG_PRESET` are intentionally left as hot-reloadable — the env watcher re-applies the logger level on reload; only the request-logging toggle is bound at boot. ## Manual verification (not yet done — please verify) - [ ] Set `LOG_LEVEL=info` (default is `warn`, and Fastify access logs emit at `info`, so `warn` hides them regardless) with `LOG_DISABLE_REQUEST_LOGGING` unset/`false`, start the server, hit any `/api/...` route, and confirm `GET /api/... completed` request logs now appear. - [ ] With `LOG_LEVEL=info` and `LOG_DISABLE_REQUEST_LOGGING=true`, confirm those per-request logs are suppressed. - [ ] Edit `LOG_DISABLE_REQUEST_LOGGING` in `.env` while the server is running and confirm the `[env-watcher]` warning now says a restart is required (and that the change indeed does not take effect until restart). ## Validation - `pnpm check` (TypeScript + ESLint). --- Targets `staging` per `CONTRIBUTING.md § Branches` / `CLAUDE.md`. Fixes #3288. Related: #3260. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:20:17 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5864
No description provided.