logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roland Weiglhofer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-345) logging.log4j-1.2-api doesn't export the log4j API 1.2. Dependent bundles can not be resolved.
Date Wed, 14 Aug 2013 07:34:47 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13739361#comment-13739361
] 

Roland Weiglhofer commented on LOG4J2-345:
------------------------------------------

Hi,
I changed the poms and I created a patch. It is a short term solution and there is a need
for discussion. It is not fully tested but it works on my machine (Apache Felix Version 4.2.1).
To whom should I send the patch-file?

The patch solves:
https://issues.apache.org/jira/browse/LOG4J2-346
https://issues.apache.org/jira/browse/LOG4J2-345

Regards
Roland

--------------------------------------------------------------------
output

lb
START LEVEL 4
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    4|Active     |    2|Apache Felix Bundle Repository (1.6.6)
    5|Active     |    2|Apache Felix Configuration Admin Service (1.6.0)
    6|Active     |    2|Apache Felix Gogo Command (0.12.0)
    7|Active     |    2|Apache Felix Gogo Runtime (0.10.0)
    8|Active     |    2|Apache Felix Gogo Shell (0.10.0)
    9|Resolved   |    2|Apache Felix Security Provider (2.2.0)
   10|Active     |    2|Apache Felix Shell Service (1.4.3)
   11|Active     |    2|Apache Log4j 1.x Compatibility API (2.0.0.beta9-SNAPSHOT)
   12|Active     |    2|Apache Log4j API (2.0.0.beta9-SNAPSHOT)
   13|Active     |    2|Apache Log4j Commons Logging Bridge (2.0.0.beta9-SNAPSHOT)
   14|Active     |    2|Apache Log4j Core (2.0.0.beta9-SNAPSHOT)
   15|Active     |    2|Apache Log4j SLF4J Binding (2.0.0.beta9-SNAPSHOT)
   16|Active     |    2|cal10n-api (0.7.4)
   17|Active     |    2|Commons Codec (1.6.0)
   18|Active     |    2|Commons IO (2.4.0)
   19|Active     |    2|Commons Lang (2.6.0)
   20|Active     |    2|Data mapper for Jackson JSON processor (1.9.13)
   21|Active     |    2|Disruptor Framework (3.1.1)
   22|Active     |    2|Gson (2.2.4)
   23|Active     |    2|Jackson JSON processor (1.9.13)
   24|Active     |    2|Jackson-annotations (2.2.2)
   25|Active     |    2|Jackson-core (2.2.2)
   26|Active     |    2|jackson-databind (2.2.2)
   27|Active     |    2|JSON.simple (1.1.1)
   28|Active     |    2|MongoDB Java Driver (2.11.2.RELEASE)
   29|Active     |    2|slf4j-api (1.7.5)
   30|Active     |    2|slf4j-ext (1.7.5)
                
> logging.log4j-1.2-api doesn't export the log4j API 1.2. Dependent bundles can not be
resolved.
> ----------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-345
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-345
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: log4j 1.2 emulation
>    Affects Versions: 2.0-beta4, 2.0-beta8, 2.0-beta9
>         Environment: OSGi / Apache Felix 4.x
>            Reporter: Roland Weiglhofer
>              Labels: Bundle, Export-Package, Maven-Bundle-Plugin, OSGi, POM
>             Fix For: 2.0
>
>
> Hi all Log4j/OSGi experts!
> Yesterday I started to migrate from log4j to log4j2. I replaced all Log4j 1.x bundles
with log4j-1.2-api as described here: http://logging.apache.org/log4j/2.x/log4j-1.2-api/index.html
> But I got following error:
> Unresolved constraint in bundle MyBundle [21]: Unable to resolve 21.0: missing requirement
[21.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.log4j)(version>=1.2.0)(!(version>=2.0.0)))
> so...I checked the capabilities of the log4j-1.2-api bundle:
> g! inspect cap * 11
> org.apache.logging.log4j-1.2-api [11] provides:
> -----------------------------------------------
> osgi.wiring.bundle; org.apache.logging.log4j-1.2-api 2.0.0.beta8 [UNUSED]
> osgi.wiring.host; org.apache.logging.log4j-1.2-api 2.0.0.beta8 [UNUSED]
> As you can see logging.log4j-1.2-api doesn't export the log4j API 1.2. It still requires
log4j 1.2. All dependent bundles can not be resolved until I add the old log4j.jar.
> The maven-bundle-plugin does not export the packages. So, my suggestion for the poms
is the following:
> parent pom
> ...
>   <properties>
>     ...
>     <osgi.export.log4j1.2>org.apache.log4j;version=1.2</osgi.export.log4j1.2>
>   </properties>
> ...
>   <build>
>     <plugins>
>       ...
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>           <instructions>
>             <_nouses>true</_nouses>
>                      <_removeheaders>JAVA_1_3_HOME,JAVA_1_4_HOME,JAVA_1_5_HOME,JAVA_1_6_HOME,JAVA_1_7_HOME,JAVA_1_8_HOME,JAVA_1_9_HOME</_removeheaders>
>           </instructions>
>         </configuration>
>       </plugin>
> ...
> log4j12-api pom
> ...
> <packaging>bundle</packaging>
> ...
>   <build>
>     <plugins>
>       ...
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <inherited>true</inherited>
>         <configuration>
>           <instructions>
>             <Bundle-SymbolicName>${osgi.symbolicName}</Bundle-SymbolicName>
>             <Private-Package>${osgi.private}</Private-Package>
>             <Import-Package>${osgi.import},*</Import-Package>
>             <DynamicImport-Package>${osgi.dynamicImport}</DynamicImport-Package>
>             <Bundle-DocURL>${project.url}</Bundle-DocURL>
>             <Export-Package>${osgi.export.log4j1.2}</Export-Package>
>           </instructions>
>         </configuration>
>       </plugin>
> ...
> First, In the parent pom I added <extensions>true</extensions> to include
the extension of the maven-bundle-plugin. Second, I deleted the manifest-entries because the
maven-bundle-plugin creates the manifest automatically. In the log4j12-api pom I switched
to <packaging>bundle</packaging>. By this the maven-bundle-plugin creates a jar
including a manifest (bundle). I added <inherited>true</inherited> to inherit
from the parent pom. Finally, I added <Export-Package>${osgi.export.log4j1.2}</Export-Package>
which exports the api and makes it accessable to other bundles.
> This should solve the issue but I didn't tested it and it may affect other projects.
> Roland 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message