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.
- 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
7 Answers
Reset to default 2Use 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