简体   繁体   English

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

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

I am logging using the jQuery.log plugin (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.日志记录在 Firefox 下的 Firebug 控制台上工作,但我必须明确启用 Firebug JavaScript 控制台。 Have a missed some option somewhere under Chrome?在 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 .我认为 Chrome 控制台即使在出现上述错误后也应该记录语句,但此处的 Chrome 可能存在某种问题,请参阅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.我在 Linux 下使用 Chrome 5.0.375,该错误被列为 Windows XP,Chrome 4.0 问题,它仍然适用。

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 .为我解决这个问题的是在 chrome 中禁用 firebug lite It was swallowing all console messages.它正在吞噬所有控制台消息。

Make sure you have the console showing and that it is showing "All".确保您有控制台显示并且它显示“全部”。

The cursor is on the button to hide/show the console.光标位于按钮上以隐藏/显示控制台。

替代文字


Update: In newer versions of Chrome, you need to click the filter icon, then make sure "All" is selected.更新:在较新版本的 Chrome 中,您需要单击过滤器图标,然后确保选择了“全部”。

控制台过滤器

When playing around with example Chrome Extensions, I was often unable to see the console.log messages when looking at console (ctrl+shift+j).在使用示例 Chrome 扩展程序时,我在查看控制台 (ctrl+shift+j) 时经常无法看到 console.log 消息。 But then I realized, that I was in the wrong place.但后来我意识到,我来错了地方。

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)这应该会显示您正在寻找的控制台。

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 日志未显示消息

Here's how it was after the change (working messages):这是更改后的情况(工作消息):在此处输入图片说明

I just found out logging was disabled from my filters.我刚刚发现我的过滤器禁用了日志记录。

带日志的过滤器

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

For me, it was because the script was being cached and the browser was not loading my latest version.对我来说,这是因为脚本被缓存而浏览器没有加载我的最新版本。

Try Ctrl+F5 to reload your page.尝试Ctrl+F5重新加载您的页面。

Resetting default setting works for me.重置默认设置对我有用。 While in the console tab, pressing F1 should open the setting page.在控制台选项卡中,按F1应打开设置页面。 There you will different settings that you can adjust including the button Restore defaults and reload .在那里,您可以调整不同的设置,包括按钮Restore defaults and reload

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM