I want to create an OSGi bundle for log4j2. I need to use some additional jars along with log4j2 such as log4j2-jcl, log4j2-jul, log4j2-web etc. I want to clarify some confusions listed below about this. However this is not specific to log4j2 I'm asking this as a general procedure.
I'm quite new to OSGi so can anyone please clarify these things no need to specific for log4j2.
Thanks!
- Do I need to create separate OSGi bundles for each jar or can I use one bundle for all the jars? (What is the best practice)
I recommend to create one bundle per JAR, if possible. This gives you the greatest flexibility and makes sure that each JAR is properly designed.
- How can I know whether OSGi bundles are already available for these jars ? (So that I don't need to re create bundles, can use existing ones)
Just have a look at the Manifest file.
If it contains the OSGi Metadata -> it's a OSGi bundle.
If it doesn't contain the OSGi Metadata -> it's not a OSGi bundle.
I think the Log4J JARs already provide the OSGi Metadata (-> they are already bundles), but I haven't double-checked.