ChatGPT解决这个技术问题 Extra ChatGPT

如何在 Chrome 开发者工具的网络选项卡中默认启用“保留日志”?

How to enable "Preserve Log" in Network tools in Chrome developer tools by default? Everytime I press F12 and then select Network tab, I need to click preserve log checkbox to make it preserve request/responses. Is it possible to have it checked all the time by default?

https://i.stack.imgur.com/YC9dY.png

By the way this feature works in "Firefox Developer" edition. When I click "Persist Logs" and close and then open the browser & DEV tools window again, it is still checked.

https://i.stack.imgur.com/uZ6KP.png

UPDATE - 6th March 2019

This will be fixed in Chrome 73. But if you want to try it before that then install Chrome Canary. It's working there. To enable/disable this persistence just go to Dev tools settings and check/uncheck Preserve Log under network section as shown below.

https://i.stack.imgur.com/n6SfI.png

Thanks to the team for fixing it. Better late than never.

Chrome has this feature but it doesn't works. I have raised a bug with the Dev tools team and they will be fixing it. bugs.chromium.org/p/chromium/issues/detail?id=761598
Unfortunately that bug is marked "wontfix"
@Kzqai - yes I agree, as of now it's that. Interesting thing is that this feature already exists and it was released into production and never worked :D. I have no idea how that happened.
There is also a preserve log for Console which seems to persist when Chrome is closed, but it does not persist for Network.
@VVV Preserve log for Network seems to persist for Firefox.

A
Adithya Giridharan

I have a small solution to that problem. I don't know whether it works correctly.First, click three dots->More tools -> Developer Tools. In that, click the three dots button(the name will be Customize and Control Dev Tools. In that, click settings.You will see a list of options with a main heading Preferences. From that, browse down to Console option. In that, just tick the option 'Preserve log upon navigation'. I guess this will solve your problem.


No it does not work. What you talked about is Console Log. But this question is about Network Logs. Console log is completely different from Network logs. These two articles explain them in detail as to what they are. developers.google.com/web/tools/chrome-devtools/console/… and this is for Network logs developers.google.com/web/tools/chrome-devtools/…
What happens if you click the Preserve log option in the same menu under network section?
It does not persist after closing Chrome.
Sorry. I didn't check it
L
LMC

Automate keystrokes to set chrome with persistent logs on Network tab. Tested with Chrome 66.

Make sure xdotool is installed

Launch chrome

Put the code below in a bash script chrome_auto.sh to send all the keys to: open a tab, dev tools, settings, set 'persistent logs', type the URL and hit enter.

#!/bin/bash

url="https://www.stackoverflow.com"
if [ -n "$1" ]; then
    url="$1"
fi

# find chrome window id
wid=$(xdotool search --class Chromium | tail -n1)
# build tab key sequence to set 'persistent logs'
tabkeys=$(for i in {1..24}; do t+="Tab ";done ;echo "$t space")
# base xdotool command
cmd="xdotool windowactivate --sync $wid"
# make chrome dance :-p
$cmd key ctrl+t
$cmd key F12
sleep 1
# open settings, move to desired option and select it
$cmd key F1 $tabkeys
sleep 1
# move cursor to URL box and type URL
$cmd key F6 type "$url"
$cmd key Return

Use the script as

./chrome_auto.sh "https://stackoverflow.com/questions/45133659"

Also, chrome can be launched with dev tools open for every tab. If this is used, comment out the line with key F12

chromium --auto-open-devtools-for-tabs > /dev/null 2>&1 &


@vvv let me know if the answer is useful for you. Thanks.
sorry seeing now. I will test this tonight.