Preserving Log and Console Settings
You'll learn how to configure your console to persist messages across page reloads and filter output for a cleaner debugging experience.
When you're debugging a web application, page navigation or refreshes normally clear the console—losing critical error messages or logs you needed to investigate. Additionally, when multiple scripts flood the console, finding relevant output becomes needle-in-haystack difficult.
What is Log Preservation?
By default, the console wipes clean whenever you navigate to a new page. Preserve log is a DevTools setting that maintains console output across page loads, redirects, and refreshes. This is invaluable when debugging issues that occur during navigation or when tracking multi-page flows.
Think of it like keeping a running transcript of a conversation, even as the room changes—nothing gets lost between scenes.
Enabling Preserve Log
In Chrome DevTools:
- Open the Console panel
- Click the settings gear icon ⚙️ (or right-click in the console area)
- Check "Preserve log"
Now messages remain visible even after navigation completes.
Context Filtering
When working with iframes, extensions, or service workers, the console can show messages from multiple execution contexts. Use the context dropdown (usually near the top-left of the console) to filter messages by:
- Top frame (your main page)
- Specific iframes
- Extension scripts
- Service workers
This isolation helps you focus on one context at a time, eliminating noise from unrelated scripts.
Other Useful Console Settings
- Show timestamps: Adds timing information to each log entry
- Hide network messages: Suppresses network-related console output
- Selected context only: Shows messages only from your currently selected frame/context
These settings persist across DevTools sessions, creating a customized debugging environment.
Key Takeaway: Enable "Preserve log" to retain console output across page loads, and use context filtering to isolate messages from specific execution contexts—dramatically improving your debugging workflow efficiency.