JEP 264: Platform Logging API and Service
daniel.fuchs at oracle.com
Wed Sep 30 16:50:40 UTC 2015
On 30/09/15 18:30, Ralph Goers wrote:
> What would be preferable is to have the serviceLoader accept “criteria” (which are callbacks) that can evaluate each of the located services based on any additional properties that are included in the properties file and either eliminate them or return a “ranking". The serviceLoader would then end up with a set of eligible services in their preferred order.
I understand you may have another use case in mind, but in
what concerns jep264's LoggerFinder though - I don't think
that would be useful. The JDK can only use one LoggerFinder
service implementation, and if more than one is found, it most
probably indicates a configuration error - where several
implementations have been put by mistake on the classpath.
Just taking the first and silently continue could end up in
strange misbehavior, where the application's developer would
not see the expected debug traces - because she configured
one framework but it's the other that happens to be used.
I believe it's a better idea to fail fast in this case.
More information about the core-libs-dev