Saturday, May 25, 2024
 Popular · Latest · Hot · Upcoming
43
rated 0 times [  47] [ 4]  / answers: 1 / hits: 48399  / 12 Years ago, tue, january 15, 2013, 12:00:00

The Chrome Developer Tools console logs an error each time a page asset (including an image) isn't found (i.e. returns 404).



In my work, I'm often working on sites where images are provided by third parties and may not be available during development. Having each missing image show up as an error in the console makes other more important errors (e.g. JavaScript errors) harder to notice.



Is there a setting that stops the console logging unfound images as errors?



Or is there some way to filter console messages by the same sort of criteria that you can filter requests by in the Network tab?



(See e.g. http://chromium.googlecode.com/issues/attachment?aid=1337330000000&name=Screenshot-Google%2B+-+Google+Chrome.png&token=1F05er8uKjAQEEBrUITFjsIGJ2A%3A1358867878658&inline=1)


More From » image

 Answers
56

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):



-/404s(NotsFound)$/


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.


[#80862] Monday, January 14, 2013, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
willieelisham

Total Points: 201
Total Questions: 108
Total Answers: 106

Location: Zambia
Member since Sat, Oct 31, 2020
4 Years ago
;