You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/10/18 20:52:00 UTC

[jira] [Resolved] (LOGGING-186) Use ServiceLoader class

     [ https://issues.apache.org/jira/browse/LOGGING-186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved LOGGING-186.
-------------------------------------
    Fix Version/s: 1.3.0
       Resolution: Fixed

> Use ServiceLoader class
> -----------------------
>
>                 Key: LOGGING-186
>                 URL: https://issues.apache.org/jira/browse/LOGGING-186
>             Project: Commons Logging
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Piotr Karwasz
>            Priority: Major
>             Fix For: 1.3.0
>
>
> The current service loader code used by {{LogFactory}} predates the {{ServiceLoader}} class introduced in Java 6 by 4 years and is a simplified version of it.
> This has many disadvantages:
> * the service loader file can *not* have any comments, like a license header or the name of the tool that generated the service file. Commons Logging just takes the first line in the file and uses it as the class name,
>  * the Service Loader Mediator OSGi specification allows to use {{ServiceLoader}} in an OSGi environment, but it might ignore direct accesses to {{META-INF/services}} resources (cf. [Apache Aries SPI Fly|https://aries.apache.org/documentation/modules/spi-fly.html]),
>  * in a JPMS environment, the {{META-INF/services}} file could even not be there and the service is declared in the module descriptor.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)