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!
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!
Accepted answer
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
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
3 other answers
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!
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