It's all about the answers!

Ask a question

How do I add logging to an Operation advisor plugin


Aliaksei Gizheuski (23610) | asked May 30 '15, 11:55 a.m.
edited May 30 '15, 1:10 p.m.
Could anyone describe how to use some logging in operation participant plugins? Where and if to put dependencies to logging jars. Where is the logging configuration stored?

By logging I meam log4j framework, but if Jazz uses some other approach please let me know.

Comments
Lawrence Smith commented May 30 '15, 12:42 p.m.
JAZZ DEVELOPER

Could you change the summary to say something like "How do I add logging to an Operation advisor plugin"? Thanks. 

Accepted answer


permanent link
Lawrence Smith (3764) | answered May 30 '15, 12:38 p.m.
JAZZ DEVELOPER
Here is an example

 import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

...

public class MyClass {

  private static final Log fgTraceLogger = LogFactory.getLog("com.ibm.example.logger");


  public boolean isOK(boolean isOK)  {

     if (!isOK) {

       fgTraceLogger.debug("Not OK!")

     }

    return isOK;

  }


--- 

Now you need to add the following to your log4j.properties file...

log4j.logger.com.ibm.example.logger=DEBUG


After changing the log settings, the following url will reload log settings without reboot:
https://server:9443/jts/admin?internal=true#action=com.ibm.team.repository.admin.reloadLogging
(this is supposed to work but it didn't for me)


You may also need 


# Default logging is for WARN and higher

log4j.rootLogger=WARN, stdout, file


See also:

https://jazz.net/wiki/bin/view/Deployment/ManipulatingCLMLog4j



Lawrence Smith [IBM]

Ralph Schoon selected this answer as the correct answer

Comments
Aliaksei Gizheuski commented May 30 '15, 1:12 p.m.

 Oh, Thanks! I will give it a try.


Ralph Schoon commented May 30 '15, 4:39 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Great, thanks Lawrence!

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.