[jboss-jira] [JBoss JIRA] (JBLOGGING-126) log4j detection broken in OSGi

Jens Reimann (JIRA) issues at jboss.org
Tue Nov 22 05:41:00 EST 2016


    [ https://issues.jboss.org/browse/JBLOGGING-126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13326231#comment-13326231 ] 

Jens Reimann commented on JBLOGGING-126:
----------------------------------------

I just looked into the package import declaration:

{code:xml}
<Import-Package>
    *;resolution:=optional
</Import-Package>
{code}

This won't catch any calls to {{Class.formName(…)}}. So an explicit import is required here.

> log4j detection broken in OSGi
> ------------------------------
>
>                 Key: JBLOGGING-126
>                 URL: https://issues.jboss.org/browse/JBLOGGING-126
>             Project: JBoss Logging
>          Issue Type: Bug
>          Components: jboss-logging-log4j
>    Affects Versions: 3.3.0.Final
>         Environment: OSGi, tested on Equinox 3.11.1
>            Reporter: Jens Reimann
>            Assignee: James Perkins
>
> This was introduced by a change in JBLOGGING-94
> The test for log4j was changed from:
> {code:java}
> Class.forName("org.apache.log4j.Hierarchy", true, cl);
> {code}
> to:
> {code:java}
> Class.forName("org.apache.log4j.config.PropertySetter", true, cl);
> {code}
> However the OSGi package imports where not updated to also include "{{org.apache.log4j.config}}". And this the latter test for "{{PropertySetter}}" will always fail in OSGi.
> The fix should be pretty simple. Simply import "{{org.apache.log4j.config}}" as optional in addition.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the jboss-jira mailing list