javascript console.log 没有将消息打印到萤火虫控制台?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7047452/
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-10-25 22:47:29  来源:igfitidea点击:

console.log doesn't print the message to the firebug console?

javascriptconsolefirebug

提问by Karthik

I am facing this weird problem. The WebApp I'm debugging right now, is invoking the javascript console.log/console.log/error/debug/etc., the Firebug console however, doesn't print them at all. This application uses Dojo/Dijit toolkit. Not sure if there is anything special about it

我正面临这个奇怪的问题。我现在正在调试的 WebApp 正在调用 javascript console.log/console.log/error/debug/etc.,但是 Firebug 控制台根本不打印它们。此应用程序使用 Dojo/Dijit 工具包。不知道有没有什么特别之处

It doesn't appear to be a problem with the Browser, I tried another simple web-page with a console.debug call, and the message appears on the console as expected.

浏览器似乎没有问题,我尝试了另一个带有 console.debug 调用的简单网页,并且消息按预期显示在控制台上。

Please advise about what should I look for. I have also tried Chrome/IE.

请告知我应该寻找什么。我也试过 Chrome/IE。

Thanks in Advance/

提前致谢/

回答by user123444555621

consoleis not write protected, it can be replaced with anything. You could try

console没有写保护,它可以用任何东西替换。你可以试试

alert(console.log.toString());

to find out what console.logreally is

找出console.log真正是什么

Edit:

编辑:

A better method would be

更好的方法是

var originalConsole = console;
// now include your library
// ...
originalConsole.log(console.log);

In Firebug, clicking on the function takes you directly to its definition.

在 Firebug 中,单击该函数会将您直接带到其定义。

回答by Mohsen

did you try window.console.log()? Maybe you are not in window scope

你试过window.console.log()吗?也许你不在窗口范围内

回答by Mr Br

In case like this do not forget to check if "Logging" is enabled or active at your console of browser.

在这种情况下,请不要忘记检查浏览器控制台中的“日志记录”是否已启用或处于活动状态。

回答by MarcoZen

Just to update this question -: Ensure that firebug is Enabled - - > On for all Web Pages. Reload the application. Then in the firebug panel - - > Console - - > All. All the console.log messages will appear.

只是为了更新这个问题-:确保已启用萤火虫--> 对所有网页都启用。重新加载应用程序。然后在firebug面板-->控制台-->全部。所有的 console.log 消息都会出现。