Fwd: Module naming for logging implementations
scolebourne at joda.org
Thu Oct 26 20:03:32 UTC 2017
(previously posted on core-libs-dev, moved by request)
I've spent some time discussing module names for logging
Most logging projects are split in two - an API and an Implementation
- where the recommended solution going forwards is to use
ServiceLoader to find the implementations. A few old projects don't
have this split, and have API and Implementation together (eg
Everyone agrees that the module name for the API must always be the
same. ie. if the SLF4J team provides a module that simulates the
Commons-Logging then it must have the same module name as
However, there are two choices for the implementation jars.
All modules that implement a particular logging API must have the same
eg. every module that implements "org.slf4j" (the API) must be named
The module name of the implementation can be whatever name makes sense.
For most service providers, option 2 is obvious, however for logging
it is generally the case that only one implementation should be
present. If all the jar files that implement a specific logging API
had the same module name (option 1) then the module system could
ensure that only one was loaded. This is a particular concern as it is
not uncommon for a jar file in Maven Central to depend on a specific
implementation of logging when it should only be depending on the API.
I'm leaning towards option 2, as it is simpler and does not require
all implementations to have the same module name (which would be
difficult to require). Any other considerations I'm missing?
More information about the jigsaw-dev