Vercel Function Logs
Use runtime logs to debug and monitor your Vercel Functions.Vercel Functions allow you to debug and monitor your functions using runtime logs. Users on the Pro and Enterprise plans can use Vercel's support for Log Drains to collect and analyze your logs using third-party providers. Functions have full support for the console
API, including time
, debug
, timeEnd
, and more.
You can view runtime logs for all Vercel Functions in real-time from the Logs tab of your project's dashboard. You can use the various filters and options to find specific log information. These logs are held for an amount of time based on your plan.
When your function is streaming, you'll get the following:
- You can view the logs in real-time from the Logs tab of your project's dashboard.
- Each action of writing to standard output, such as using
console.log
, results in a separate log entry. - Each of the logs are 4 KB per line.
- The path in streaming logs will be prefixed with a forward slash (
/
).
For more information, see Runtime Logs.
These changes in the frequency and format of logs will affect Log Drains. If you are using Log Drains we recommend ensuring that your ingestion can handle both the new format and frequency.
When a Function on a specific path receives a user request, you may see more than one log when the application renders or regenerates the page.
This can occur in the following situations:
- When a new page is rendered
- When you are using Incremental Static Regeneration (ISR)
In the case of ISR, multiple logs are the result of:
- A stale page having to be regenerated. For stale pages, both HTML (for direct browser navigation) and JSON (for Single Page App (SPA) transitions) are rendered simultaneously to maintain consistency
- On-demand ISR happening with
fallback
set asblocking
. During on-demand ISR, the page synchronously renders (e.g., HTML) upon request, followed by a background revalidation of both HTML and JSON versions
In Next.js projects, logged functions include API Routes (those defined in pages/api/**/*.ts
or app/**/route.ts
).
Pages that use SSR, such as those that call getServerSideProps
or export revalidate
, will also be available both in the filter dropdown and the real time logs.
Was this helpful?