3

The console in my Chrome DevTools is full of junk. From what I see these are logs from Chrome extensions, and I'd like them to go away. It's very annoying because I have to clear the console output after every refresh before I start debugging. I couldn't find anything on Google, so if anyone knows how to prevent extensions' logs appearing in there please let me know.

This is what it looks like on StackOverflow:

screenshot of browser DevTools console

2
  • what if I need them? Because in this case I do...
    – imaginois
    Oct 14, 2012 at 3:23
  • No good answer, but this is really been annoying me since it started happening. Hoping Chrome adds a flag to Canary that is false by default that extension developers can enable to see the extension logs.
    – LocalPCGuy
    Jun 10, 2013 at 14:40

6 Answers 6

13

Two other methods I've found in the forums. I found these both do exactly what i wanted. I chose the first, but the second will work too.

Filter out all messages from a particular source file by right-clicking the white (blank) part of console message line and choosing Filter > Hide Messages from foo.js. You can undo this filtering from the same menu later, if you wish. Chrome will remember to do this filtering for you until you disable it (even if you navigate somewhere else or restart Chrome).

Chrome itself features user profiles and fast user switching. Add a user from chrome://settings/. You can test your webapp from the new user you created. Switching between users is just a matter of clicking on the icon on the top left and then select the other user

1
  • 1
    The Filter option doesn't appear to work for me. Regardless of where I right-click in the console, all I ever get is a greyed-out "Unhide all" under the Filter menu. Using Chrome 47.0.2526.80 m
    – pcormier
    Dec 15, 2015 at 16:56
5

Update 2023

After ten years it's now easy to be done

you can right-click on a log entry and select hide it enter image description here

it will write this to the filter box

-url:chrome-extension://bla../content.js
1
  • 1
    Um, this is exactly what @b.grady suggested nine years ago: "right-clicking the white (blank) part of console message line and choosing Filter > Hide Messages from foo.js" Jul 26, 2023 at 18:01
1

There is not easy way to disable just loggig of extensions. You can disable extensions easily and get rid of their logging.

But if in your case you want to "ignore" extensions logs you can make your own logs more visible by using new"%c"styling command in console.

Add this function to top of your code to make your logs bold and big and make it easy to ignore extensions logs.

var _log = console.log;
console.log = function() {
  _log.call(console, '%c' + [].slice.call(arguments).join(' '), 'font-weight:bold; font-size: 16px');
};

Note that this feuture is just introduced and you will need Chrome Canary to use it.

enter image description here

1
  • 2
    This is a useful tip, but you have to admit that adding %c every time can prove to be very frustrating. I've decided to work in incognito window, which is also good because it won't cache stuff all that much, hopefully not at all. In chrome there is the option of setting which extensions only to be visible in incognito mode
    – imaginois
    Oct 28, 2012 at 15:54
1

You should use incognito mode. Almost of extensions is not allowed in incognito mode unless you allow them.

0

You can somewhat reduce the visible output volumes - filter the required level of messages by selecting the appropriate button in the bottom statusbar (in the screenshot, the "All" button is selected; "Errors", "Warnings", and "Logs" are available).

1
  • The problem is that there are log of all kinds (Warning, Info, Errors, etc.) and the given cluttering is very annoying
    – imaginois
    Oct 28, 2012 at 15:49
0

To add to the answers suggesting the right-click and filter method:

The "right-click and filter" method (right-clicking the white blank part of a console message and choosing "Hide Messages from X") adds a -url:xxx filter to the filter box, with the full URL of the log's source file.

However, the URL used in a -url:xxx filter doesn't have to be the full URL: -url:chrome-extension:// will hide almost everything that includes chrome-extension:// in the source URL. This will hide all regular logs from all extensions (warnings generated by the browser instead of being logged with the console object are not filtered).

The same behavior applies: the filter is kept until manually removed.

(Please note that this behavior was likely added after other answers were posted, which would mean it was not possible to do this at the time. Exact methods have also changed.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.