On Fri, 2025-01-10 at 08:51 +0100, Carsten Ziegeler wrote:
> I think there are two potential issues. One is the breaking change of
> the exported package org.apache.sling.commons.log.logback (major
> version 
> change). Not sure, about the impact.

No bundles import that package in the Sling Starter. I have found only
one reference in the Sling codebase, in a log webconsole IT [1]. So
probably no concerns in Sling.

> 
> The other one is SPIFLy. I agree, requiring it is probably better
> than 
> not supporting slf4j 2.x. However, I still think we should try to
> avoid it.
> 
> The only idea that comes to my mind is to do the same as we do with 
> Apache Felix Jetty. We release two jars, the "normal" one where we
> embed 
> jetty and the "light" one which does not. If you choose the light
> one, 
> you have to install all the jetty bundles yourself, SPIFly and 
> potentially other things. On the other hand, it allows you to update 
> Jetty without waiting for the next Apache Felix Jetty release.
> 
> This way we might catch two cookies with one fork.

This assumes that we embed and re-export the SLF4j API as well, right?
This is the one with the unsatisfiable references. I am not familiar
with the ServiceLoader behaviour in OSGi, but I assume that it will
work with resources and classes within a single bundle.

This would definitely work, with the slight drawback of needing to
upgrade slf4j and logback. Definitely viable IMO.

I wonder though (I read "too many hacks" in Julian's email ;-) ) if we
could branch off in a different direction and create a bundle that does
the SPIFly's job but in a simple way that is specific for the commons-
log/slf4j situation:

1. Advertise an osgi.serviceloader capability, but restricts its
visiblity via a hook (ResolverHook? [2] ) to only the slf4j api bundle
2. Processes the slf4j api bundle to add an import to the specific
implementation of the ( WeavingHook? [3] )

I don't think this can be done directly in the commons-log bundle
because we'd have a circular dependency between it and the slf4j-api
bundle.

Thanks,
Robert

> 
> Regards
> Carsten

[1]:
https://github.com/apache/sling-org-apache-sling-commons-log-webconsole/blob/44a7d9eaf55eed940f69542ed4abadc9c316a523/src/test/java/org/apache/sling/commons/log/webconsole/remote/WebConsoleTestActivator.java#L37
[2]:
https://docs.osgi.org/specification/osgi.core/8.0.0/framework.resolverhooks.html#d0e44398

[3]:
https://docs.osgi.org/specification/osgi.core/8.0.0/framework.weavinghooks.html#org.osgi.framework.hooks.weaving.WovenClass.getDynamicImports
--

Reply via email to