36

Starting a few versions ago, Google Chrome has started showing JS violations in the developer console. While that can be useful sometimes, more often it is just cluttering the console.

Violations in dev console

Is there a way to disable these violations?

As a side note, also since recently, the developer console no longer features checkboxes for the various types of debug output. Now you only have log levels: Verbose, Info, Warnings, Errors. I find the former method with checkboxes much more useful - is there some way (a flag?) to make them come back?

marlar
  • 3,858
  • 6
  • 37
  • 60
  • 6
    See https://crbug.com/717776 and https://crbug.com/714235. The intent of chromium developers was to make console filtering better although I fail to imagine the angle necessary to see the new behavior as an enhancement. – wOxxOm May 17 '17 at 11:32
  • 6
    I agree. This is a step in the wrong direction. – marlar May 18 '17 at 10:16
  • If you select "Info", you get rid of the violations. But it doesn't just show Info the way it used to. :( – jmargolisvt May 18 '17 at 15:01
  • 2
    @jmargolisvt. Also, if I select info to get rid of violations, I don't see the debug messages. – marlar May 19 '17 at 09:37
  • I'll never understand why people remove useful things. And add useless stuff (like the new plugin options display). Seriously, who thought that this "`User messages only`" checkbox was useless? – Olivier Pons Apr 19 '18 at 11:02

4 Answers4

32

In latest Chrome (64.0.3282.167), add the following to your "Filter" box with "All levels" selected:

-[Violation]

Not sure if any sort of Regex is supported any longer (previous versions of Chrome had a checkbox that allowed you to filter by expression), but the - seems to be a "don't match".

typeoneerror
  • 55,990
  • 32
  • 132
  • 223
  • Regex are still supported, just enclose your enclose your /regex/ in slashes. – marlar Feb 18 '18 at 09:34
  • 3
    I'll never understand why people remove useful things. And add useless stuff (like the new plugin options display). Seriously, who thought that this "`User messages only`" checkbox was useless? – Olivier Pons Apr 19 '18 at 11:01
  • 1
    If, like me, you have already added other filters, add a space before this and it will work (as of Feb 2019) – tomjen Feb 25 '19 at 09:45
  • Example as @marlar was suggesting: `-/Warning:\sA\s+future\s+version/` filters the following: `Warning: A future version of React will...` . Notice that you must use `\s` to match spaces. – Ross Rogers Aug 12 '20 at 23:23
10

Yes, as of Chrome 58:

  • The Hide violations checkbox is gone. Set the logging level dropdown
    to Verbose to see violations.

In the following screenshot, it is set to "Info": Log level options

msanford
  • 11,803
  • 11
  • 66
  • 93
9

Another option:

  1. Open Console Settings (the gear icon).
  2. Check the User Messages Only checkbox to only show messages logged from scripts. Browser violations are hidden when this checkbox is enabled.

Chrome version: 62.0.3169.0 (Official Build) canary (64-bit)

enter image description here

Bob Stein
  • 16,271
  • 10
  • 88
  • 101
Kayce Basques
  • 23,849
  • 11
  • 86
  • 120
  • 1
    as @OlegPnk said this isnt ideal - as it hides exceptions and other errors that you'd need to see. – owenmelbz Nov 16 '17 at 10:23
  • 2
    I'll never understand why people remove useful things. And add useless stuff (like the new plugin options display). Seriously, who thought that this "`User messages only`" checkbox was useless? – Olivier Pons Apr 19 '18 at 11:02
1

As of Chrome 92

Using the Console UI

The console has now a left panel on which messages can be filtered by source and type, you can open the panel and select user Messages as seen below:

Filter User Messages

Downside to this approach is that once you close the panel, the filters won't be applied anymore, so if you lack of horizontal real-state on your screen, this might not be for you.

Source: https://developer.chrome.com/docs/devtools/console/reference/#browser

Using Console Message Filters

If you want to get rid of the [Violation] ... and DevTools ... messages you can filter by -/^\[Violation\]|DevTools/ (A negated RegExp) or just use -[Violation] -DevTools, apparently you can use multiple filters separated by space.

Sources: