It's all about the answers!

Ask a question

Managing RTCL Client logging (LogAdapter logs)


Pat McCarthy (12152) | asked Sep 19 '08, 5:23 p.m.
JAZZ DEVELOPER
I've got goals and a few methods to get there, but its still a bit odd the way some things work and the lack of granular control I seem have with the some of the options I've tried so far.

Domain: RTC Client, plugins added to the client, creating log msgs using the Log object returned by the LogAdapter.getLog("plugin.uniuqe.id");

Goals (first 2 can be done, not the last):
- get my log msgs added to the RTC error log view
- control what log levels are active for my log id
- be able to turn on logging or adjust levels for my log id from outside (using an RTC Client launch parm)

What I know so far:
These log levels are enabled by default:
-info: false
-trace: false
-debug: false
-warn: true
-error: true
-fatal: true

My warn, error, and fatal log msgs are added to the Error Log view.

Want to get more logging for my plugin, vs the whole RTC Client platform.
Tried these techniques:
- adding a log4j.properties file to my plugin (src folder). No joy, even after adjusting the build def to include the file
- using this runtime parameter to identify my log4j.properties file: -Dlog4j.configuration=myFile.name - this worked beyond expectations

Beyond expectations = all log levels were enabled, for all loggers/log ids.
I tried using a file that existed, or even one that did not exist; same result.

-Dlog4j.configuration - this kills the launch
-Dlog4j.configuration= - kills the launch too
-Dlog4j.configuration=file.name.exists - the file is ignored - all log levels enabled
-Dlog4j.configuration=file.name.does.not.exist - the file is not used (does not exist) - all log levels enabled

When all log levels are enabled across the board, it takes about 20 seconds for the Error Log to stop showing new content when I start the RTC Client.
Entries like this sail by:
monitorJob.run(TeamService cancel monitor for: /jazz/service/com.ibm.team.repository.common.internal.IRepositoryRemoteService(126)): waiting() <--

So I can change it from some log levels to all, but only for all log ids; a bit noisy.

The only way I've found to get granular control is to:
- import this plugin to my workspace: com.ibm.team.log4j.ui
- adjust the resources\log4j.properties file to include my log id: log4j.logger.com.ibm.rfrs.team.logging=TRACE, stdout

Then I get all log levels for my log id, and not all of the RTC Client.

Problem is I can only do this when launching the RTC Client in run/debug mode from my RTC Client SDK.

I want to be able to add/enhance my plugin logging levels after it is installed as part of the RTC Client.

Q - Why does the -Dlog4j.configuration=file.name not actually work?
Q - Should it?

Q - Is there another technique I should be trying instead?

Pat Mc.

3 answers



permanent link
Pat McCarthy (12152) | answered Sep 24 '08, 1:07 p.m.
JAZZ DEVELOPER
My bad - where I say LogAdapter it should be LogFactory - this class:
com.ibm.team.repository.common.LogFactory

Not sure I can change the subject of the original post.

permanent link
Matt Lavin (2.7k2) | answered Sep 25 '08, 3:51 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
For logging on the Eclipse client, I would recommend using the standard
Eclipse log methods. Using the Eclipse logging methods will allows you
get your log messages in the 'error log' view from Eclipse. There is
some documentation on the ILog interface here:
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/ILog.html

Matt Lavin
Jazz Server Team


patmc wrote:
I've got goals and a few methods to get there, but its still a bit odd
the way some things work and the lack of granular control I seem have
with the some of the options I've tried so far.

Domain: RTC Client, plugins added to the client, creating log msgs
using the Log object returned by the
LogAdapter.getLog("plugin.uniuqe.id");

Goals (first 2 can be done, not the last):
- get my log msgs added to the RTC error log view
- control what log levels are active for my log id
- be able to turn on logging or adjust levels for my log id from
outside (using an RTC Client launch parm)

What I know so far:
These log levels are enabled by default:
-info: false
-trace: false
-debug: false
-warn: true
-error: true
-fatal: true

My warn, error, and fatal log msgs are added to the Error Log view.

Want to get more logging for my plugin, vs the whole RTC Client
platform.
Tried these techniques:
- adding a log4j.properties file to my plugin (src folder). No joy,
even after adjusting the build def to include the file
- using this runtime parameter to identify my log4j.properties file:
-Dlog4j.configuration=myFile.name - this worked beyond expectations

Beyond expectations = all log levels were enabled, for all loggers/log
ids.
I tried using a file that existed, or even one that did not exist;
same result.

-Dlog4j.configuration - this kills the launch
-Dlog4j.configuration= - kills the launch too
-Dlog4j.configuration=file.name.exists - the file is ignored - all
log levels enabled
-Dlog4j.configuration=file.name.does.not.exist - the file is not used
(does not exist) - all log levels enabled

When all log levels are enabled across the board, it takes about 20
seconds for the Error Log to stop showing new content when I start
the RTC Client.
Entries like this sail by:
monitorJob.run(TeamService cancel monitor for:
/jazz/service/com.ibm.team.repository.common.internal.IRepositoryRemoteService(126)):
waiting() <--

So I can change it from some log levels to all, but only for all log
ids; a bit noisy.

The only way I've found to get granular control is to:
- import this plugin to my workspace: com.ibm.team.log4j.ui
- adjust the resources\log4j.properties file to include my log id:
log4j.logger.com.ibm.rfrs.team.logging=TRACE, stdout

Then I get all log levels for my log id, and not all of the RTC
Client.

Problem is I can only do this when launching the RTC Client in
run/debug mode from my RTC Client SDK.

I want to be able to add/enhance my plugin logging levels after it is
installed as part of the RTC Client.

Q - Why does the -Dlog4j.configuration=file.name not actually work?
Q - Should it?

Q - Is there another technique I should be trying instead?

Pat Mc.

permanent link
Pat McCarthy (12152) | answered Sep 29 '08, 12:54 p.m.
JAZZ DEVELOPER
Re Eclipse logging vs RTC logging.
We're comfy with Eclipse logging options, but want to be able to log using a single technique that also works when the code is involved in non-RTC Client use of the Jazz client libraries.

Testing also shows us that the RTC log provided by the LogFactory class ends up putting msgs in the Eclipse Error Log view - so we get that for "free" right now when running in the RTC Client, and also get standard logging when in other runtime configurations.

We just want to be able to control log levels for debug purposes, during development and later when the code has been installed/configured.

P.

For logging on the Eclipse client, I would recommend using the standard
Eclipse log methods. Using the Eclipse logging methods will allows you
get your log messages in the 'error log' view from Eclipse. There is
some documentation on the ILog interface here:
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/ILog.html

Matt Lavin
Jazz Server Team


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.