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

Configuring my plugin to use Log4J

I am spinning my wheels on a problem and could use a little guidance.
I am trying to configure my plugins to use Log4J, this is what I have till now:

1. I have added log statements to my main plugin classes
2. I created a log4J plugin project (Create Plugin from existing Jar archives) - called this log4JPlugin
3. Next, I created a log4J fragment that has the log4J.properties file in it - called Log4JFragment and attached it to the log4JPlugin.
4. I added the log4JPlugin as a dependency to my main plugin class
5. When I invoke the plugin via Jetty, the log statements print to the console, but not to the log files (they did not even get created)
--
6. To deploy it on Tomcat, I created a log4jFeature site for the log4jPlugin
7. I added the log4JFeature as a dependency in my main plugin class's feature.xml, and then created the update site
8. Added the update site to ccm/jts folders and started up tomcat.

The plugin doesn't become Active (when viewed from the OSGI screen). It always stays as "Installed", and the logs state that it could not find the Log4JFeature.

So, my questions are:
1. When running on Jetty, if the logger statements could get picked up and printed on the console, why couldn't the log files get created? I do not have any missing Appender errors in the console.
2. How can I add the log4JFeature so that it deploys on Tomcat properly?

Thanks for all your help!

0 votes


Accepted answer

Permanent link
Ok, I am still confused..

you have TWO plugin projects

application
log4j service plugin

both can be deployed in the same site
(site->feature->plugin)

so a feature plugin can reference multiple function plugins
(I use this way)
or a site project can reference multiple feature plugins

anyhow, I was suggesting to do away with the log4j project,
and include the jar and properties as part of the application code plugin.

there are probably messages in the server/logs/ccm.log file
Anita Jey selected this answer as the correct answer

0 votes


3 other answers

Permanent link
this might help..

http://www.eclipsezone.com/eclipse/forums/t99588.html

seems you need to include the log4j jar in your plugin and the properties file as well.

I do this on a plugin using a commons.logging jar file (added to the lib directory of the plugin definition)

Sam

0 votes


Permanent link
Hello Sam,

Thanks for your response. I have the log4j jar already included in the log4jplugin, and the log4j.properties is available under the log4jFragment project. I had also gone through the online resource you have referred , but I am missing something that I am not able to pinpoint...

Thanks!

this might help..

http://www.eclipsezone.com/eclipse/forums/t99588.html

seems you need to include the log4j jar in your plugin and the properties file as well.

I do this on a plugin using a commons.logging jar file (added to the lib directory of the plugin definition)

Sam

0 votes


Permanent link
Thanks for your help Sam. I included the log4j plugin alone in my main plugin code, and it finally worked. Whew!!!..... Thanks again!

0 votes

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
× 10,937

Question asked: May 16 '12, 4:27 p.m.

Question was seen: 6,388 times

Last updated: May 16 '12, 4:27 p.m.

Confirmation Cancel Confirm