Save the console.log in Chrome to a file
Solution 1:
Good news
Chrome dev tools now allows you to save the console output to a file natively
- Open the console
- Right-click
- Select "save as.."
Chrome Developer instructions here.
Solution 2:
I needed to do the same thing and this is the solution I found:
-
Enable logging from the command line using the flags:
--enable-logging --v=1
This logs everything Chrome does internally, but it also logs all the console.log()
messages as well. The log file is called chrome_debug.log
and is located in the User Data Directory
which can be overridden by supplying --user-data-dir=PATH
(more info here).
- Filter the log file you get for lines with
CONSOLE(\d+)
.
Note that console logs do not appear with --incognito
.