JEP 264: Platform Logging API and Service
Ralph Goers
ralph.goers at dslextreme.com
Wed Sep 30 18:33:26 UTC 2015
You are correct that the discussion on the serviceLoader may be off-topic wrt JEP 264. I believe I mentioned that currently Log4j only supports binding with a single implementation as well. But we don’t take the first, we take the one with the highest priority.
Ralph
> On Sep 30, 2015, at 9:50 AM, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
>
> Hi Ralph,
>
> 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.
>
> best regards,
>
> -- daniel
>
>
More information about the core-libs-dev
mailing list