Console.log 消息未显示在 Chrome 的 javascript 控制台中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3240523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 03:49:15  来源:igfitidea点击:

Console.log messages not showing up in Chrome's javascript console?

javascriptjquerylogginggoogle-chrome

提问by James McMahon

I am logging using the jQuery.logplugin (which logs to console.log if available) and I am not seeing any of the logging messages appear in the Chrome JavaScript console.

我正在使用jQuery.log插件(如果可用,它会记录到 console.log)进行日志记录,但我在 Chrome JavaScript 控制台中没有看到任何日志消息。

Logging works on Firebug's console under Firefox, but I did have to explicitly enable the Firebug JavaScript console. Have a missed some option somewhere under Chrome?

日志记录在 Firefox 下的 Firebug 控制台上工作,但我必须明确启用 Firebug JavaScript 控制台。在 Chrome 下的某个地方错过了一些选项?

Edit:
The only thing being logged to the console is

编辑:
唯一记录到控制台的是

Uncaught Syntax error, unrecognized expression: |button

未捕获的语法错误,无法识别的表达式:|按钮

I assume that the Chrome console is suppose to log statements even after errors like the one above, but there may be some kind of issue with Chrome here, see http://code.google.com/p/chromium/issues/detail?id=29062. I am using Chrome 5.0.375 under Linux and that bug is listed as a Windows XP, Chrome 4.0 issue, it could still apply.

我认为 Chrome 控制台即使在出现上述错误后也应该记录语句,但此处的 Chrome 可能存在某种问题,请参阅http://code.google.com/p/chromium/issues/detail? id=29062。我在 Linux 下使用 Chrome 5.0.375,该错误被列为 Windows XP、Chrome 4.0 问题,它仍然适用。

回答by sf.

I've just had the same problem and found this question when trying to find an answer.

我刚刚遇到了同样的问题,并在试图找到答案时发现了这个问题。

What fixed this for me was disabling firebug lite in chrome. It was swallowing all console messages.

为我解决这个问题的是在 chrome 中禁用 firebug lite。它正在吞噬所有控制台消息。

回答by Mottie

Make sure you have the console showing and that it is showing "All".

确保您有控制台显示并且它显示“全部”。

The cursor is on the button to hide/show the console.

光标位于按钮上以隐藏/显示控制台。

alt text

替代文字



Update: In newer versions of Chrome, you need to click the filter icon, then make sure "All" is selected.

更新:在较新版本的 Chrome 中,您需要单击过滤器图标,然后确保选择了“全部”。

console filter

控制台过滤器

回答by brent5000

When playing around with example Chrome Extensions, I was often unable to see the console.log messages when looking at console (ctrl+shift+j). But then I realized, that I was in the wrong place.

在使用示例 Chrome 扩展程序时,我在查看控制台 (ctrl+shift+j) 时经常无法看到 console.log 消息。但后来我意识到,我来错了地方。

Wrench -> Tools -> Extensions and then click on the appropriate link under "Inspect active views". (in the Chrome examples it is often background.html) This should bring up the console that you are looking for.

扳手 -> 工具 -> 扩展,然后单击“检查活动视图”下的相应链接。(在 Chrome 示例中,它通常是 background.html)这应该会显示您正在寻找的控制台。

回答by Дамян Станчев

On my computer I had accidently clicked the Debug filter. This made my log messages hidden. Here's how it was before (hidden messages): Chrome log not showing messages

在我的电脑上,我不小心点击了调试过滤器。这使我的日志消息隐藏。这是之前的情况(隐藏消息): Chrome 日志未显示消息

Here's how it was after the change (working messages): enter image description here

这是更改后的情况(工作消息): 在此处输入图片说明

回答by Ajai Singh

I am not sure if this is the case, but if you are using firebug with chrome, you have to turn firebug off in order for console.log() to work in Developer Tools.

我不确定是否是这种情况,但是如果您在 chrome 中使用 firebug,则必须关闭 firebug,以便 console.log() 在开发人员工具中工作。

回答by fer

I just found out logging was disabled from my filters.

我刚刚发现我的过滤器禁用了日志记录。

filters with logging

带日志的过滤器

回答by payne

For me, it was because the script was being cached and the browser was not loading my latest version.

对我来说,这是因为脚本被缓存而浏览器没有加载我的最新版本。

Try Ctrl+F5to reload your page.

尝试Ctrl+F5重新加载您的页面。

回答by tutug

Resetting default setting works for me. While in the console tab, pressingF1should open the setting page. There you will different settings that you can adjust including the button Restore defaults and reload.

重置默认设置对我有用。在控制台选项卡中,按F1应打开设置页面。在那里,您可以调整不同的设置,包括按钮Restore defaults and reload

回答by NELSON RODRIGUEZ

I have this error by have obfuscated javascript code, deobfuscate and console.log work again)

我有这个错误,因为混淆了 javascript 代码,deobfuscate 和 console.log 再次工作)