L17 · Build & preview · 5 min

Logs: your app's diary (and where to find them)

In one sentence

A log is your app's diary—one structured line recorded for each important event with its level, route, request ID and duration—kept free of secrets or personal data and found in four places: the browser console, your local terminal, Vercel build logs and Vercel runtime logs.

Think of it like this

Think of a ship's logbook. Every watch, the captain writes one dated line: the weather, the heading, and any warning light. When the ship hits rough water, you don't guess what happened—you open the logbook to that exact minute.

How it works

A DefinitionlogYour app's diary: one line per event. When something breaks, the logs say what happened.Open in the glossary → is your app's diary: one line written each time something notable happens. To make logs easy for both you and your Definitioncoding agentAn AI that works in your project folder: it reads files, writes code and runs commands, with your permission.Open in the glossary → to search, your app writes structured logs—one JSON line per event containing a level (info for normal events, warn for something unusual, error when an action failed), a plain message, a short request ID, the page or route, and how long it took (duration).

Just as important is what must never go into a log: never record a DefinitionsecretAnything that opens your accounts: API keys, passwords, tokens. Kept only in Vercel and `.env.local`.Open in the glossary →, token, password, personal data (such as emails or phone numbers), or AI DefinitionpromptThe message you give an AI model. Clear prompts get better results.Open in the glossary →s and model outputs. For AI calls, your app logs only the price (X-Tokentide-Charge-USD), the request ID, the feature name and which provider answered.

When you work on your computer, logs live in two places: 1. The browser [[console]] (Right-click → Inspect → Console) for DefinitionfrontendThe part of an app that runs in the visitor's browser: what people see and click.Open in the glossary → events that happen on the screen, and 2. Your local [[terminal]] running npm run dev for DefinitionbackendThe part of an app that runs on a server: it keeps data, checks logins and talks to other services.Open in the glossary → events that happen on the server.

When your app runs on DefinitionVercelThe service that turns your code on GitHub into a live site, with a Preview for every change.Open in the glossary →, there are two more places: 3. Vercel build logs (npx vercel inspect <url> --logs), which explain why a deployment failed to build, and 4. Vercel runtime logs (npx vercel logs <url>, kept for 1 hour on the Hobby plan), which show what the live or Preview server is doing right now.

1 · Event happensOne JSON lineRecords `level` (`info`/`warn`/`error`), `message`, `requestId`, `route` and `duration`.
2 · Safety filterZero secrets or PIINever logs API keys, passwords, emails, prompts or AI answers—only cost and request ID.
3 · Four placesWhere to read itLocal: browser console & `npm run dev` terminal. Online: Vercel build & runtime logs.
FIG. 1 · How structured logging works: each event writes one clean JSON line without secrets, readable in four places across local and Vercel.

What it looks like in your project

You don't have to hunt through logs by hand. Tell your agent what happened and whether it was on localhost or on a Vercel link, and it will check the terminal or run npx vercel logs itself and summarize what the diary says.

Copy for your agent

Check our app's logging setup: make sure server events write one structured JSON line (level, message, requestId, route, duration) and verify we never log secrets, personal data, prompts or model outputs.

Quick check · 1 question

Which of these is safe and useful to write in your app's server logs?

Go deeper

Next lessonDebugging with your agent: reproduce, find, fix, prove

Last reviewed Nov 8, 2026