It's all about the answers!

Ask a question

Logging message in RTC server plug-in static block


Geoff Alexander (19623948) | asked Jun 08 '12, 9:05 a.m.
I have a static block in one of my RTC server plug-in classes in which I would like to write a message to ccm.log.  How do I obtain the RTC server Log class in the static block?  Or is there some other way of logging messages in the static block?

Accepted answer


permanent link
Andrew Niefer (7135) | answered Jun 08 '12, 10:36 a.m.
JAZZ DEVELOPER
The server is using org.apache.commons.logging, you can get a logger using the static
Log log = LogFactory.getLog(YourClass.class);

By default I believe this will log to the server/logs/jazz.log file.
Logging settings are in server/conf/jazz/log4j.properties if you want to add specific rules for YourClass.
Geoff Alexander selected this answer as the correct answer

Comments
Geoff Alexander commented Jun 08 '12, 11:35 a.m. | edited Jun 08 '12, 1:45 p.m.

Thanks Andrew.  Your answer solved my problem.

I had looked at using the com.ibm.team.repository.common.LogFactory class.  But this class only has a getLog(String componentId) method, and I wasn't sure what to pass in for the componentId.

Using the getLog(Class clazz) method from the org.apache.commons.logging.LogFactory class as you suggest works like a charm.  In fact, the log message is written to the RTC log (ccm.log) rather than jazz.log file just as I want.  I suspect that the getLog(Class clazz) method "knows" that my class is part of an RTC server plug-in and so returns the RTC log rather than the JTS log.


scott herzinger commented Jan 07 '13, 1:28 p.m.

I have a similar need. My plugins extend AbstractService. Any comments on whether using AbstractService.getLog() is a good idea or not? It already appears to know how to find the componentId.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.