Persist Google Chrome Console Logs

Recently I faced with a requirement to save/persist Chrome console logs in a file specifically when running automated tests. There are other ways as well to persist console logs than the one which I will explain in this article but this one is the simplest.

Actually there’s a flag --enable-logging with which Chrome logs are persisted automatically in a file chrome_debug.log. All you need to do is execute Chrome/Chromium from terminal/command prompt.

// for google-chrome
google-chrome --enable-logging

// for chromium-browser
chromium-browser --enable-logging

The file chrome_debug.log is saved in Chrome’s user data directory which is different for each OS (Linux, Mac OS X, Windows, and Chrome OS). I use Ubuntu so in my case it’s saved under directory:

// for google-chrome

// for chromium-browser

If you found this post useful then don’t forget to subscribe for updates using RSS or Email.

comments powered by Disqus