fastify/fastify · warning · FastifyDeprecation

FSTDEP023

FSTDEP023

Error message

disableRequestLogging option is deprecated. Use the logController option with disableRequestLogging or isLogDisabled override instead. The disableRequestLogging top-level option will be removed in `fastify@6`.

What it means

Emitted by fastify.js:889 when the top-level disableRequestLogging option is present (options.disableRequestLogging !== undefined). v5 moved logging control into the logController option; the top-level disableRequestLogging alias will be removed in fastify@6.

Source

Thrown at lib/warnings.js:56

})

const FSTSEC001 = createWarning({
  name: 'FastifySecurity',
  code: 'FSTSEC001',
  message: 'You are using /%s/ Content-Type which may be vulnerable to CORS attack. Please make sure your RegExp start with "^" or include ";?" to proper detection of the essence MIME type.',
  unlimited: true
})

const FSTDEP022 = createWarning({
  name: 'FastifyWarning',
  code: 'FSTDEP022',
  message: 'The router options for %s property access is deprecated. Please use "options.routerOptions" instead for accessing router options. The router options will be removed in `fastify@6`.',
  unlimited: true
})

const FSTDEP023 = createWarning({
  name: 'FastifyDeprecation',
  code: 'FSTDEP023',
  message: 'disableRequestLogging option is deprecated. Use the logController option with disableRequestLogging or isLogDisabled override instead. The disableRequestLogging top-level option will be removed in `fastify@6`.',
  unlimited: true
})

const FSTDEP024 = createWarning({
  name: 'FastifyDeprecation',
  code: 'FSTDEP024',
  message: 'requestIdLogLabel option is deprecated. Use the logController option with requestIdLogLabel instead. The requestIdLogLabel top-level option will be removed in `fastify@6`.',
  unlimited: true
})

const FSTDEP025 = createWarning({
  name: 'FastifyDeprecation',
  code: 'FSTDEP025',
  message: 'Calling addHttpMethod for existing method "%s" without { overrideExisting: true } is deprecated. In Fastify v6, this will throw an error.',
  unlimited: true
})

View on GitHub (pinned to 7299a57d3f)

Solutions

  1. Pass a LogController instance via the logController option with disableRequestLogging in its constructor.
  2. Or use the isLogDisabled override on the log controller for per-request decisions.

Example fix

// before — triggers FSTDEP023
const { fastify } = require('fastify')
const app = fastify({ disableRequestLogging: true })

// after
const { fastify, LogController } = require('fastify')
const app = fastify({
  logController: new LogController({ disableRequestLogging: true })
})
Defensive patterns

Strategy: validation

Validate before calling

// Fail fast if the deprecated top-level disableRequestLogging is used
function assertNoDisableRequestLogging (options) {
  if (options && Object.hasOwn(options, 'disableRequestLogging')) {
    throw new Error('Use logController: new LogController({ disableRequestLogging: ... }) instead of the top-level option')
  }
}
assertNoDisableRequestLogging(fastifyOptions)

Prevention

When it happens

Trigger: Fastify({ disableRequestLogging: true }) or Fastify({ disableRequestLogging: (req) => req.url.includes('/health') }) — any value (boolean or function) at the top level.

Common situations: Upgrading from v4/v5.0 where this was the documented way to silence per-request logs; silencing health-check logs; carrying old config forward.

Related errors


AI-assisted analysis of fastify/fastify@7299a57d3f (2026-08-03). Data as JSON: /data/errors/3a3e72b1150635dd.json. Report an issue: GitHub.