Thank you Raymond and BJ. Your suggestions were very appreciated. I was not aware of the Service Loader Mediator and for my use case, it seems the easier path. In fact, I think Ceki Gulcu had to switch to Service Loader while "JPMSing" SLF4J. The slf4j-osgi code is very interesting and uses some advanced stuff that will need to look with more attention.
Once again, thank you. João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, Jul 12, 2018 at 3:22 PM, BJ Hargrave <hargr...@us.ibm.com> wrote: > You can see what I have done for an SLF4J binding for the OSGi Log Service > 1.4 spec in R7 at https://github.com/osgi/slf4j-osgi. I will note I have > not tried it in a while, so it may be in need of some attention. > -- > > BJ Hargrave > Senior Technical Staff Member, IBM // office: +1 386 848 1781 > OSGi Fellow and CTO of the OSGi Alliance // mobile: +1 386 848 3788 > hargr...@us.ibm.com > > > > ----- Original message ----- > From: "João Assunção via osgi-dev "<osgi-dev@mail.osgi.org> > Sent by: osgi-dev-boun...@mail.osgi.org > To: OSGi Developer Mail List <osgi-dev@mail.osgi.org> > Cc: > Subject: [osgi-dev] How would you implement SLF4J binding ? > Date: Thu, Jul 12, 2018 11:09 AM > > Hello all, > > I'm currently trying to implement a facade for a metrics library and one > of the objectives is to make its usage agnostic of the runtime environment. > At my place, we have some components that are mainly used in the context of > an OSGi container but can also be used in plain Java applications. I want > to have three implementations of the facade where one makes use of an > OSGi service, the other is a plain java library and the third a no-op. In > essence, I want the usage of this facade to be similar to SLF4J. While > replicating the mechanism used in SLF4J I remembered someone in this > mailing list saying that the way SLF4J binds to the implementations is a > hack and not recommended. I agree with the hack part but to me, as a user, > it works quite well. > If anyone could suggest better approaches I would be very grateful. > > PS: > This is what I'm trying to achieve: > > > .... > private final Counter aCounter = MetricsFactory.getCounter("aCounter"); > ... > > > > Thank you. > > João Assunção > > Email: joao.assun...@exploitsys.com > Mobile: +351 916968984 > Phone: +351 211933149 > Web: www.exploitsys.com > > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev > > > >
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev