logging

Control what the dev server prints: fetches, requests, Server Functions and browser output.

Signature
logging?: false | { fetches?: { fullUrl?: boolean; hmrRefreshes?: boolean }; serverFunctions?: boolean; incomingRequests?: boolean | { ignore: RegExp[] }; browserToTerminal?: boolean | 'warn' | 'error' }
  • Added in Next.js v14.0.0

Parameters

ParameterTypeDescription
$fetches.fullUrloptionalboolean= falseLogs the complete URL of each fetch made during development instead of an abbreviated form.
$fetches.hmrRefreshesoptionalboolean= falseAlso logs fetch requests restored from the Server Components HMR cache, which are skipped by default.
$serverFunctionsoptionalboolean= trueLogs each Server Function invocation with its name, arguments and duration. Set to false to disable.
$incomingRequestsoptionalboolean | { ignore: RegExp[] }= trueLogs incoming requests during development. Pass false to disable, or an object with an ignore array of regular expressions to skip matching paths.
$browserToTerminaloptionalboolean | 'warn' | 'error'= falseForwards browser console output to the terminal with source location. true forwards log, info, warn and error; 'warn' forwards warnings and errors; 'error' forwards only errors; false disables forwarding.
$loggingoptionalfalse= undefinedPassing false instead of an object disables development logging entirely.

Changelog

  • PHP v16.2.0browserToTerminal added, moved from experimental.browserDebugInfoInTerminal.
  • PHP v15.4.0experimental.browserDebugInfoInTerminal introduced.
  • PHP v15.2.0incomingRequests added.
  • PHP v15.0.0logging: false added, and fetches.hmrRefreshes added for the App Router.
  • PHP v14.0.0logging.fetches moved to stable for the App Router.

Everything here affects the development terminal only; production builds are untouched. The options divide into four independent streams.

  • fetches.fullUrl prints the whole URL of each server-side fetch, so you can see the query string an upstream call actually sent. fetches.hmrRefreshes additionally shows fetches served from the Server Components HMR cache, which are hidden by default.
  • serverFunctions is on by default and prints each call as └─ ƒ myAction(arg1, arg2) in 5ms app/actions.ts.
  • incomingRequests logs every request; { ignore: [...] } takes regular expressions, which is how you silence a health check that fires every second.
  • browserToTerminal forwards console calls from the browser into the terminal with file and line, so you can debug a Client Component without switching to DevTools.

What trips people up

fullUrl prints query strings verbatim — API keys and signed tokens included — into your terminal and any scrollback you share. Server Function logging prints arguments, so a form's field values land in the log too. And logging: false silences the routine dev output, not compile or runtime errors.

Example

Example · typescript
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  logging: {
    fetches: {
      fullUrl: true,
    },
  },
}

export default nextConfig

When to use it

  • See the exact upstream URL, query string included, that a Server Component fetch requested.
  • Stop a health check endpoint from flooding the dev terminal.
  • Read Client Component console output in the terminal instead of switching to browser DevTools.

Frequently asked questions

How do I see the full fetch URL in the Next.js dev server logs?

Set logging.fetches.fullUrl to true in next.config and restart the dev server. Add fetches.hmrRefreshes: true if you also want fetches served from the Server Components HMR cache, which are hidden by default.

How do I stop health check requests from filling the dev terminal?

Pass logging.incomingRequests: { ignore: [/\/api\/v1\/health/] } with a regular expression matching the path. Setting incomingRequests to false disables request logging entirely.

Can I see browser console.log output in the terminal?

Yes, set logging.browserToTerminal to true for all console output, or 'warn' / 'error' to forward only those levels. Forwarded lines include the source file and line number. The option was added in v16.2.0, replacing experimental.browserDebugInfoInTerminal.

More examples

Quieting a noisy dev terminal

The ignore array takes regular expressions matched against incoming requests, so a health check polling once a second stops burying the logs you care about. Turning off serverFunctions also stops action arguments — which may include whatever a user typed into a form — from being printed.

Example · typescript
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  logging: {
    incomingRequests: {
      ignore: [/\/api\/v1\/health/, /\/__probe/],
    },
    serverFunctions: false,
  },
}

export default nextConfig

Debugging a Client Component from the terminal

With 'warn', only console.warn and console.error cross over; true forwards log and info as well. Each forwarded line carries its source location, so a warning prints as [browser] Hello World (app/page.tsx:8:17) and you can jump straight to it without opening DevTools.

Example · typescript
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  logging: {
    browserToTerminal: 'warn',
  },
}

export default nextConfig

Turning development logging off

The false shorthand replaces the whole object and silences routine development output. Compile errors and runtime errors are still reported — this hides the request and fetch chatter, not the failures.

Example · typescript
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  logging: false,
}

export default nextConfig

Discussion

  • Be the first to comment on this lesson.