Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Logging message in RTC server plug-in static block

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?

0 votes


Accepted answer

Permanent link
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

1 vote

Comments

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.

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jun 08 '12, 9:05 a.m.

Question was seen: 5,572 times

Last updated: Jan 07 '13, 1:28 p.m.

Confirmation Cancel Confirm