Can I prevent the Chrome Developer Tools console from logging image 404 errors? [duplicate]
Solution 1:
Work has "started" on this by the Chromium team: https://code.google.com/p/chromium/issues/detail?id=96212
Update: The feature request was closed on March 18, 2013. I'm not sure in which version of Chrome this feature first appeared, but I can confirm console filtering options in my Chrome v33.0.1750.152 (Linux).
Update 2: Currently, when a filter (plain text or regular expression) is entered, it is tested against the message text (e.g. GET http://example.com/foobar 404 (Not Found)
) as well as the text of the right side link (e.g. test.html:65
). (I have filed an issue with Chromium to track this.)
As a workaround, use a regular expression filter like:
^(?!.* 404 \(Not Found\))(?!.*[file name])
where [file name]
is the file name from the right side link.
For example, if my page is test.html
, then ^(?!.* 404 \(Not Found\))(?!.*test\.html)
will work.
Note: This will also filter out messages that have the file name in the message text. I'm not sure there is a way around this for now.
Update (2019-06-05): This expression will filter out 404s in my current version of Chrome (75.0.3770.80):
-/404\s\(Not\sFound\)$/
It seems the filtering first splits the filter string by whitespace before processing each token, but it will also split spaces inside of a regular expression, so the \s
's are necessary.
Technically, this will filter out any message ending with the (case insensitive) string "404 (Not Found)", including console.log
messages.
Solution 2:
In the chrome developer tools, it's under the "Console" tab. Click "Filter" and it will be on the filter line as a checkbox.