Chrome: console.log, console.debug are not working

Google ChromeConsole

Google Chrome Problem Overview


Console.log and debug not printing, only return undefined. Why it can be? I've tried to re-install chrome, but it doesn't help.

Here is screenshot from chrome's main page, so functions are not redefined in some code console.log doesn't work

Google Chrome Solutions


Solution 1 - Google Chrome

Click “Default levels” and make sure that "Info" is checked. By default it is only set to show Errors and Warnings

I came here with the same problem :/

Solution 2 - Google Chrome

For completeness: In the current version of chrome, the setting is no longer at the bottom but can be found when clicking the "Filter" icon at the top of the console tab (second icon from the left)

Solution 3 - Google Chrome

As of today, the UI of developer tools in Google chrome has changed where we select the log level of log statements being shown in the console. There is a logging level drop-down beside Filter input box. Supported values are Verbose, Info, Warnings and Errors. The default selection in the drop-down is Info.

enter image description here

Any log whose severity is equal or higher will get shown in the Console tab e.g. if selected log level is Info then all the logs having level Info, Warning and Error will get displayed in console.

When I changed it to Verbose then console.debug and console.log statements started showing up in the console. Till the time Info level was selected, they were not getting shown.

Solution 4 - Google Chrome

Same issue, but I just cleared my settings. I went into Settings > Preferences and Clicked [Restore defaults and reload]. Just remember what your settings were.

enter image description here

Solution 5 - Google Chrome

Make sure that the "Filter" input is left blank and nothing is written intentionally or by mistake. That was it in my case :P

enter image description here

Solution 6 - Google Chrome

I experienced the same problem. The solution for me was to disable Firebug because Firebug was intercepting the logs in the background resulting in no logs being shown in the Chrome console.

Solution 7 - Google Chrome

There could also be some filters applied to the console. Remove them.

Solution 8 - Google Chrome

As of July 2020 the Chrome UI has changed once again and the logging level dropdown doesn't seem to do anything now.

Instead, there's a new pane to the left of the main console pane, which may have got unintentionally set to one of the restrictive logging levels:

enter image description here

Select the top category (messages) to reveal all the logging:

enter image description here

EDIT: EVEN THEN Chrome seems to add things to the Filter box, which again loses some logging, so you must CLEAR THE FILTER BOX TOO!

(Filter box is at the top of both my pics above, under "Network conditions"; you can see that it has some contents about "urlwebpack" which I didn't put there!)

Solution 9 - Google Chrome

In my case was webpack having the UglifyPlugin running with drop_console: true set

Solution 10 - Google Chrome

If you are seeing(3 messages are hidden by filters. Show all messages.) then click on show all message link in Chrome dev tool console.

Because if this option enabled by mistake the console.log("") message will show but this will in in hidden state.

Solution 11 - Google Chrome

I'm working on a site where some JS (or other) code is preventing console.log from working (console.log is probably overwritten). You can test this by checking if console.log works on a different page (like this one).

I don't have time to investigate further right now so used alert("something is: "+something) to get the info I wanted from a snippet I needed to run.

Solution 12 - Google Chrome

Selecting verbose fixed it for meVerbose

Solution 13 - Google Chrome

Click “Default levels” right next to filter and do make sure that "Info" is checked.

Please see screenshot:

enter image description here

Solution 14 - Google Chrome

Sometimes the simplest things trip us up...

Type console.log in the console and check what function gets returned. If you see ƒ log() { [native code] } then it's something else. If you see ƒ (){} then somewhere down the line the native console.log function was changed.

Was working on a client's site today and that was the issue. If that's the case, you can either manually restore the console.log function or use console.dir() or console.warn() instead.

If you see ƒ (){} then there is a possibility that sometime console stops working due to some functionality you have added in your javascript. so first close all tabs restart chrome and in a new tab just typ1 console.log('hi'); if it prints that then it confirms that the problem is there in your script code. if not then restore the cosole.log.

To restore the console in new tab go to console and type delete window.console it will return true after that restart the chrome and you are good to go.

Solution 15 - Google Chrome

In my case preserve logs do the trick. I did everything to show the logs, but it goes away. I checked it and it works,

enter image description here

Solution 16 - Google Chrome

In my case it was just an old cached Javascript file. After clearing the cache I saw my logs.

Solution 17 - Google Chrome

In my case, i was not able to see logs because there is some text in Filter field, which caused results of console.log to disappear. Once we clear text in Filter field, it should show.

Solution 18 - Google Chrome

see if something show on the filter box in console ,it means something override your script clear the filter box and check again. i my case this is the issue.

Solution 19 - Google Chrome

Another tip, why console.log doesn't works is that the Filter search field must be empty.

enter image description here

Solution 20 - Google Chrome

This worked for me. In the console section, go to the settings on top right. There select preserve log and Log XMLHttpsRequests.

Solution 21 - Google Chrome

Make sure the filter box is empty

Solution 22 - Google Chrome

React Dev Tools Extension Causing the Issue

If you have React Developer Tools extension installed, unistalling it fixed my issue. Obviously this might be a difficult trade off.

I never used them so deleting them solved it in my case.

enter image description here

Solution 23 - Google Chrome

In my case, the solution was for me to click on "Top" and select debuggerWorker.aca... localhost:8081

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIhar KrasnikView Question on Stackoverflow
Solution 1 - Google ChromeAlexey BorovikovView Answer on Stackoverflow
Solution 2 - Google ChromeFriedrich GroßeView Answer on Stackoverflow
Solution 3 - Google ChromeRBTView Answer on Stackoverflow
Solution 4 - Google ChromeTimView Answer on Stackoverflow
Solution 5 - Google ChromeDeval KhandelwalView Answer on Stackoverflow
Solution 6 - Google ChromeMemet OlsenView Answer on Stackoverflow
Solution 7 - Google ChromeAdrianaView Answer on Stackoverflow
Solution 8 - Google ChromeReg EditView Answer on Stackoverflow
Solution 9 - Google ChromeianazView Answer on Stackoverflow
Solution 10 - Google ChromeNandu HulsureView Answer on Stackoverflow
Solution 11 - Google ChromeavjaarsveldView Answer on Stackoverflow
Solution 12 - Google ChromeTy HarlackerView Answer on Stackoverflow
Solution 13 - Google ChromeAmir shahView Answer on Stackoverflow
Solution 14 - Google ChromeAndyView Answer on Stackoverflow
Solution 15 - Google ChromeNoman_ibrahimView Answer on Stackoverflow
Solution 16 - Google ChromeAlex OsmolovskyView Answer on Stackoverflow
Solution 17 - Google ChromeBharatView Answer on Stackoverflow
Solution 18 - Google ChromeHeshanHHView Answer on Stackoverflow
Solution 19 - Google ChromeMaxoView Answer on Stackoverflow
Solution 20 - Google ChromeAdarsh TrivediView Answer on Stackoverflow
Solution 21 - Google ChromeIshan RijalView Answer on Stackoverflow
Solution 22 - Google ChromedctsView Answer on Stackoverflow
Solution 23 - Google ChromeBigBrosView Answer on Stackoverflow