Safari Developer Tools: How to Preserve Console Log Upon Navigation?
Asked Answered
D

6

81

When using Safari Web Inspector to read the JavaScript console output, the log is reset upon navigation i.e. going from page index.html to mail.html clears the console output. In the Chrome Developer Tools, I can easily preserve the log by right clicking on the console space and selecting Preserve Log Upon Navigation. With this option, console log output remains intact until I manually clear the output simplifying the process of debugging JavaScript that refreshes or redirects to another page.

Is there a similar feature in Safari Web Inspector?

Dachia answered 28/1, 2013 at 22:48 Comment(2)
I don't think so, at least i haven't found it to be the case.Elisa
you could overwrite the console.log method, store all data received, save it in localstorage upon navigation 'a'.click, and re-apply it on some event like document.ready, but its rather hackyRathenau
R
68

I don't know when this was added, but it is present in Safari on El Capitan (Safari 9.0). It works the same as in Chrome (right click in the console window and select "Keep Log on Navigation").

Update: As per Daniel Compton's answer, in Safari 11+ this is now under the settings icon as 'Console: Clear when page navigates'.

Update: The setting is now back to "Preserve log" in the Network tab in the developer console in Safari 14+

Update: At least in Safari 17 (not sure about 15-16), there are separate "Preserve Log" options for the Network tab and the Console. It's under the menu icon that looks like a circle with three horizontal lines of descending lengths and appears in the top bar of each tab.

Richellericher answered 9/10, 2015 at 0:33 Comment(5)
They could have hide it a bit more!Unruh
The location of this setting does not even make sense... why is it in the console tab and not in the network or the general settings? Anyway many thanks for the answer.Thermoelectricity
As Daniel Compton points out, as of Safari 11 this is no longer the case. Please see his answer for recent instructions.Limassol
Unfortunately both options don't seem to be available in Safari 7.1 - I guess I should upgrade.Radiothermy
very nice that I have to spend my precious 1 minute free trial on browserstack with searching for this option in safari 13. None of the above seem to work there.Dharma
O
15

In Safari 11.1.2 they moved it again(!) back to the Console tab under the "Preserve log" checkbox. The Network log has similarly moved back to the Network tab.

Console tab


In Safari 11 they moved it to the Settings panel under "Console: Clear when page navigates". It also has a sister setting "Network: Clear when page navigates".

enter image description here

Offset answered 1/10, 2017 at 0:43 Comment(1)
This is the latest still, why the button is surfing through the tabs anyways.Ylem
A
14

As of October 2022, Safari 16 and MacOS Monterey 12.6, for some reason the setting is now hidden here:

safari 16+ preserve logs location

safari 16+ preserve logs option

As @joseantgv wished in the accepted answer's comments, they excelled again and were able to hide it a little bit more 🤣🤷🏽‍♂️

Alley answered 21/10, 2022 at 8:32 Comment(0)
G
7

No, there is no such feature (in Safari 5.0 at least). Looking at some Google results, I don't think this feature exists in any Safari version.

Gullah answered 24/12, 2013 at 4:19 Comment(1)
safari 5 is ancient, i assume your on windows and there for using 5Sabulous
S
2

Omg, I spend so much time to find it in version 16, it is currently at Console tab but under some dedicated icon.

enter image description here

Stalinsk answered 21/11, 2023 at 9:6 Comment(0)
E
0

For old Safari versions, you can right-click on the console and select the Keep Log on Navigationenter image description here

Empale answered 10/3, 2020 at 13:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.