It's all about the answers!

Ask a question

Console.log in Java extension?


Dave Evans (1362137) | asked Dec 30 '13, 6:33 p.m.

Greetings,

When "developing" javascripts within RTC, I find the console.log method to be very handy. What is the best "printf" method of debugging I can use from within an extension? I have a working Operation Advisor, but am now adding functionality to it and a piece is not working properly and I'd rather just use prints than debugging with Jetty at this point.

Thanks!

Accepted answer


permanent link
Aradhya K (1.4k44345) | answered Dec 31 '13, 1:18 a.m.
JAZZ DEVELOPER
You can use below statements to get the Log instance which will log the statements you want in ccm,log.

import org.apache.commons.logging.Log;
import com.ibm.team.repository.common.LogFactory;
private static final Log fLog= LogFactory.getLog("<Logger.Name>");

You can use fLog.debug  to this instead of sysout.
You can control the log level from the log4j.properties in server\conf\ccm
log4j.logger.<Logger.Name>=debug
Dave Evans selected this answer as the correct answer

One other answer



permanent link
Dave Evans (1362137) | answered Dec 30 '13, 6:36 p.m.
P.S. I can use the collector for now, but I was just wondering if there was an eaier method to use such as a message box or just writing to the error log.

Comments
sam detweiler commented Dec 30 '13, 8:12 p.m.

I use System.out.println and watch the server console (windows command prompt).

funny, I'd rather debug than watch the print output.


Dave Evans commented Jan 02 '14, 11:41 a.m. | edited Jan 02 '14, 11:42 a.m.

I'd rather debug than watch print out, too...but I've never developed anything in Java before and I didn't bother to get debugging working since it wasn't trivial. I am certain I will get to that point soon though! But I got my first extension (Operation Advisor) working nicely: An owner can't approve their own work items.


sam detweiler commented Jan 02 '14, 12:25 p.m.

I just start my normal server in debug mode.  then connect from Eclipse to a Remote app.

debug both client and server at the same time.  only case where I can't do this is when I develop a jazz client side plugin, ten I need to start another eclipse locally in debug mode.

just add one line to the server.startup.bat as the last JAVA_OPTS line

set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=3388

then the remote app port is 3388

Your answer


Register or to post your answer.