最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - console.log does nothing in Firebug in Liferay - Stack Overflow

programmeradmin1浏览0评论

I have several debug printouts in my script with console.log(message), but no messages displayed in Console section of Firebug.

What can be a reason for this?

UPDATE 1

Neither of console.warn, console.error and console.info works.

UPDATE 2

I have a following log function:

function log(message) {
   console.error(message);
   $("#log").append(message + "<br/>");
}

so it logs both into Firebug console and DIV on page. I see that DIV logging works. Hence the control reaches the statements.

UPDATE 3

--irrelevant--

UPDATE 4

Update 3 was irrelevant: consoleBody in firebug.js was not always null. Later it was being valued.

But I saw that the content of consoleBody contains "div#log". Probably it interferes with my naming...

UPDATE 5

Renaming of ID of my DIV didn't help...

UPDATE 6

Whe I do console.log("hehe") in immediate line of firebug, it prints undefined

UPDATE 7

Looks like console.log() does not work within Liferay portlet at all; even very simple hello world portlet does not excecute this mand.

I have several debug printouts in my script with console.log(message), but no messages displayed in Console section of Firebug.

What can be a reason for this?

UPDATE 1

Neither of console.warn, console.error and console.info works.

UPDATE 2

I have a following log function:

function log(message) {
   console.error(message);
   $("#log").append(message + "<br/>");
}

so it logs both into Firebug console and DIV on page. I see that DIV logging works. Hence the control reaches the statements.

UPDATE 3

--irrelevant--

UPDATE 4

Update 3 was irrelevant: consoleBody in firebug.js was not always null. Later it was being valued.

But I saw that the content of consoleBody contains "div#log". Probably it interferes with my naming...

UPDATE 5

Renaming of ID of my DIV didn't help...

UPDATE 6

Whe I do console.log("hehe") in immediate line of firebug, it prints undefined

UPDATE 7

Looks like console.log() does not work within Liferay portlet at all; even very simple hello world portlet does not excecute this mand.

Share Improve this question edited Jan 23, 2012 at 19:59 Dims asked Jan 23, 2012 at 18:36 DimsDims 51.4k130 gold badges359 silver badges653 bronze badges 6
  • 4 Most likely the statements aren't actually reached. Have you attached a debugger to see where it goes wrong? – JaredPar Commented Jan 23, 2012 at 18:38
  • It is very plex script... wait will post something... – Dims Commented Jan 23, 2012 at 18:44
  • Have you tried breakpointing your code? – JaredMcAteer Commented Jan 23, 2012 at 18:45
  • Yes: logging line is reached and just does nothing – Dims Commented Jan 23, 2012 at 18:47
  • Where are you calling console.log() from? A portlet's JSP? Javascript file? ... – dejuknow Commented Jan 23, 2012 at 21:34
 |  Show 1 more ment

7 Answers 7

Reset to default 2

Use javascript.log.enabled=false property. This will disable firebug lite, now console.log will log to browser's console.

I'm not sure what's the reason for such behaviour for 6.0 version but I have found the reason it doesn't work in 5.2.3.

It seems that Liferay includes Firebug Lite on my page and when I press F12 it appears at the bottom. It does interceps console method calls.

Now I'm looking for correct way to remove the included script.

EDIT: Seems like the reason for this is that I have developer mode enabled.

set JAVA_OPTS=%JAVA_OPTS% -Dexternal-properties=portal-developer.properties

Try console.info. If that fails, use one of console.warn or console.error.

There may be a setting to remove this requirement from Firefox.

The situation occurs when Liferay 6.0 is running under Eclipse. Eclipse Liferay Plugin upgrade to 1.5 didn't help.

One can set fresh Liferay installation, run it under Eclipse and try console.log('hehe') in Firebug's immediate line -- it won't work.

But this bug does not occur in Liferay 6.1 with Tomcat 7.

Looks like it was some bug of Liferay 6.0. Log works in Liferay 6.1

$("#log") does not work in Liferay 5.2. The right syntax (in no-conflict mode) for Liferay is jQuery("#log") as they use multiple js frameworks.

Someone has found a way to disable Firebug-Lite pletely by renaming the dirname webapps/ROOT/html/js/firebug.. It seems to work but I also did what SO user "Yogesh Agrawal" suggested in his answer from Jul 4 at 5:27

See http://www.liferay./munity/forums/-/message_boards/message/14202657

发布评论

评论列表(0)

  1. 暂无评论