Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log4j under OSGI (Eclipse RCP)

After many tests i concluded that the Log4j is not working under OSGI.

I do not use Log4j directly, but i need third party plugins to log with it.

I made a plain JAVA project and everything works great, but under PLUGIN development nothing works.

I have log4j jar in my Classpath and even tried a Spring repository OSGI compliant Log4j and included it under Dependencies. Nothing works.

I've tried this some approach with no success: http://swik.net/Eclipse/Planet+Eclipse/Raja+Kannappan:+Eclipse+RCP+-+Converting+Dependencies+to+OSGi+Bundles/drqpf

and could not fully understand this one: http://www.eclipsezone.com/eclipse/forums/t99588.html

Can anyone point me on the right direction?

Thanks.

like image 216
marcolopes Avatar asked Mar 01 '11 04:03

marcolopes


1 Answers

You simply have to create log4j fragment bundle with the log4j.properties file inside.

UPDATE: Some things to look for:

  • Header name should be: Fragment-Host: log4j.
  • log4j.properties should be in the src folder.
  • All the bundles which use log4j should have org.apache.log4j in their Import-Package attribute
like image 153
Eugene Ryzhikov Avatar answered Oct 10 '22 01:10

Eugene Ryzhikov