Set the console before you reproduce#
In Chrome DevTools, change these before the failing step, not after:
| Setting | Where | Why it matters |
|---|---|---|
| Preserve log | Console settings | Keeps messages across navigations and reloads. Without it, a redirect or a reload clears the lines that led up to it. |
| Show timestamps | Console settings | Puts a time on each line, so the maintainer can line it up with requests and server logs. |
| Log level Verbose | The levels menu next to the filter | Shows console.debug messages, which the default levels hide. Many libraries log their state at debug level. |
| Selected context only off | Console settings | Includes messages from iframes and workers, not only the top page. |
Chrome DevTools: Console reference
Then reproduce, and right-click in the console to Save as…, which writes the visible messages to a text file. Copying from the console works too, but check that the copy kept the timestamps.
Expand the error before you save it#
A collapsed error shows its message and the first stack frame. The saved file shows what was visible. Expand the error so the whole stack is included, and expand any logged objects the maintainer will need, because a collapsed object saves as a one-line summary.
Chrome also evaluates a logged object when you expand it, not when it was logged. If the page changed the object afterward, the expanded view shows the later value. The small i icon beside an expanded object says so. When a value at the time of logging matters, log a copy such as JSON.stringify(value).
Include warnings and network errors#
Turn on the warnings and errors that are not from console.* calls:
- Log XMLHttpRequests adds a line for each XHR and fetch, which shows the order of requests among the messages.
- Violation warnings, such as long tasks and forced reflows, appear at Verbose level. They matter for a page that freezes.
- Network failures such as
net::ERR_BLOCKED_BY_CLIENTappear as errors even with no script involved. A request with no status code lists what each one means.
Capture the console from a script#
When the reproduction is a Playwright script, collect the messages with their location:
page.on('console', msg => {
const { url, lineNumber } = msg.location();
console.log(new Date().toISOString(), msg.type(), msg.text(), `${url}:${lineNumber}`);
});
page.on('pageerror', err => console.log(new Date().toISOString(), 'pageerror', err.stack));
pageerror reports uncaught exceptions, which the console event does not. Playwright: Page events
A Playwright trace records console messages alongside each action, so a trace makes a separate console file unnecessary.
Worked example: the warning that came first#
This example is fictional. A tester reports TypeError: Cannot read properties of undefined (reading 'items') on the cart page and attaches a screenshot of that error.
The developer asks for the console saved with Preserve log, timestamps and Verbose. The saved file shows three lines the screenshot did not:
14:02:11.204 [debug] cart: restoring from storage (schema v2)
14:02:11.207 [warn] cart: unknown schema v2, expected v3; using defaults
14:02:11.389 Uncaught TypeError: Cannot read properties of undefined (reading 'items')
The cart's stored schema was older than the code expected. The error was the third symptom of a migration that never ran. The developer seeded a v2 cart in local storage and the error replayed.
Questions#
Does Firefox save the console the same way?
Firefox's Web Console has its own options to persist logs and show timestamps, and can export the messages to a file or the clipboard. The settings live in different menus, so check them before reproducing.
The console is full of messages from extensions. Should I remove them?
Filter them out of what you send if they are clearly unrelated, and say that you did. If the bug might involve an extension, keep them, and see Works in incognito.
Can console logs contain secrets?
Yes. Applications sometimes log tokens, user objects or request bodies. Read the file before sharing it.
Return to reproducing what someone else saw for the other layers a replay needs.